mirror of
https://github.com/zadam/trilium.git
synced 2024-12-26 09:12:08 +08:00
parsing links in html to keep references between notes in links table
This commit is contained in:
parent
b307907796
commit
a36282caf0
1 changed files with 14 additions and 0 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue