Skip to content

Build your personal knowledge base with Trilium Notes

fix pasting HTML content into subnotes

azivner8b41c1ef3144
diff --git a/src/public/javascripts/services/tree.js b/src/public/javascripts/services/tree.js
index ae766b7900..244d899e6d 100644
--- a/src/public/javascripts/services/tree.js
+++ b/src/public/javascripts/services/tree.js
@@ -530,8 +530,8 @@ function parseSelectedHtml(selectedHtml) {
if (dom.length > 0 && dom[0].tagName && dom[0].tagName.match(/h[1-6]/i)) {
const title = $(dom[0]).text();
- const domWithoutTitle = dom.slice(1);
- const content = domWithoutTitle.map(el => $(el).html()).join("");
+ // remove the title from content (only first occurence)
+ const content = selectedHtml.replace(dom[0].outerHTML, "");
return [title, content];
}