parsing links in html to keep references between notes in links table

This commit is contained in:
azivner 2017-09-17 21:58:03 -04:00
parent b307907796
commit a36282caf0

View file

@ -8,6 +8,20 @@ function html2notecase(contents, note) {
if (globalHtmlEnabled) {
note.detail.note_text = contents;
if (!note.detail.encryption) {
const linkRegexp = /<a[^>]+?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;
}