cleaned up images and links which are not used nor supported

This commit is contained in:
azivner
2017-11-29 20:47:01 -05:00
parent d019d0a690
commit 3386cd790e
7 changed files with 13 additions and 59 deletions

View File

@@ -59,31 +59,8 @@ const noteEditor = (function() {
}
}
function parseHtml(contents, note) {
note.links = [];
note.images = [];
note.detail.note_text = contents;
if (!note.detail.is_protected) {
const linkRegexp = /<a[^>]+?href="[^"]*app#([A-Za-z0-9/]+)"[^>]*?>[^<]+?<\/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]
});
}
}
}
function updateNoteFromInputs(note) {
const contents = noteDetailEl.summernote('code');
parseHtml(contents, note);
note.detail.note_text = noteDetailEl.summernote('code');
const title = noteTitleEl.val();