diff --git a/src/entities/note.js b/src/entities/note.js index 6eb87c5b2..da3a49cc5 100644 --- a/src/entities/note.js +++ b/src/entities/note.js @@ -805,7 +805,7 @@ class Note extends Entity { WHERE noteId = ? AND isDeleted = 0 AND type = 'relation' AND - name IN ('internalLink', 'imageLink', 'relationMapLink')`, [this.noteId]); + name IN ('internalLink', 'imageLink', 'relationMapLink', 'includeNoteLink')`, [this.noteId]); } /** diff --git a/src/services/import/tar.js b/src/services/import/tar.js index 49bedc41b..8b0b58ce1 100644 --- a/src/services/import/tar.js +++ b/src/services/import/tar.js @@ -147,7 +147,7 @@ async function importTar(taskContext, fileBuffer, importRootNote) { continue; } - if (attr.type === 'relation' && ['internalLink', 'imageLink', 'relationMapLink'].includes(attr.name)) { + if (attr.type === 'relation' && ['internalLink', 'imageLink', 'relationMapLink', 'includeNoteLink'].includes(attr.name)) { // these relations are created automatically and as such don't need to be duplicated in the import continue; } diff --git a/src/services/notes.js b/src/services/notes.js index 79b7c193c..dacf40d62 100644 --- a/src/services/notes.js +++ b/src/services/notes.js @@ -242,6 +242,20 @@ function findInternalLinks(content, foundLinks) { return content.replace(/href="[^"]*#root/g, 'href="#root'); } +function findIncludeNoteLinks(content, foundLinks) { + const re = /
/g; + let match; + + while (match = re.exec(content)) { + foundLinks.push({ + name: 'includeNoteLink', + value: match[1] + }); + } + + return content; +} + function findRelationMapLinks(content, foundLinks) { const obj = JSON.parse(content); @@ -263,10 +277,11 @@ async function saveLinks(note, content) { } const foundLinks = []; - +console.log("Scanning", content); if (note.type === 'text') { content = findImageLinks(content, foundLinks); content = findInternalLinks(content, foundLinks); + content = findIncludeNoteLinks(content, foundLinks); } else if (note.type === 'relation-map') { findRelationMapLinks(content, foundLinks);