diff --git a/static/js/html2notecase.js b/static/js/html2notecase.js index 54ec2b2dd..0b4ee7375 100644 --- a/static/js/html2notecase.js +++ b/static/js/html2notecase.js @@ -8,6 +8,20 @@ function html2notecase(contents, note) { if (globalHtmlEnabled) { note.detail.note_text = contents; + if (!note.detail.encryption) { + const linkRegexp = /]+?href="[^"]*kapp#([A-Za-z0-9]{22})"[^>]*?>[^<]+?<\/a>/g; + let match; + + while (match = linkRegexp.exec(contents)) { + console.log("adding link for " + match[1]); + + note.links.push({ + note_id: note.detail.note_id, + target_note_id: match[1] + }); + } + } + return; }