diff --git a/src/entities/note.js b/src/entities/note.js index 739eec983..5ab002880 100644 --- a/src/entities/note.js +++ b/src/entities/note.js @@ -811,11 +811,9 @@ class Note extends Entity { SELECT * FROM attributes WHERE noteId = ? AND - isDeleted = 0 AND - ((type = 'relation' AND - name IN ('internalLink', 'imageLink', 'relationMapLink', 'includeNoteLink')) - OR - (type = 'label' AND name = 'externalLink'))`, [this.noteId]); + isDeleted = 0 AND + type = 'relation' AND + name IN ('internalLink', 'imageLink', 'relationMapLink', 'includeNoteLink')`, [this.noteId]); } /** diff --git a/src/public/javascripts/widgets/attributes.js b/src/public/javascripts/widgets/attributes.js index 80b860d86..3c4644d33 100644 --- a/src/public/javascripts/widgets/attributes.js +++ b/src/public/javascripts/widgets/attributes.js @@ -69,19 +69,7 @@ export default class AttributesWidget extends CollapsibleWidget { async renderAttributes(attributes, $container) { for (const attribute of attributes) { if (attribute.type === 'label') { - if (attribute.name === 'externalLink') { - $container.append('@' + attribute.name + "="); - $container.append( - $('') - .text(attribute.value) - .attr('href', attribute.value) - .addClass('external') - ); - $container.append(" "); - } - else { - $container.append(utils.formatLabel(attribute) + " "); - } + $container.append(utils.formatLabel(attribute) + " "); } else if (attribute.type === 'relation') { if (attribute.value) { $container.append('@' + attribute.name + "="); diff --git a/src/services/import/tar.js b/src/services/import/tar.js index 432923ead..f09c26d16 100644 --- a/src/services/import/tar.js +++ b/src/services/import/tar.js @@ -152,11 +152,6 @@ async function importTar(taskContext, fileBuffer, importRootNote) { continue; } - if (attr.type === 'label' && attr.name === 'externalLink') { - // also created automatically - continue; - } - if (attr.type === 'relation') { attr.value = getNewNoteId(attr.value); } diff --git a/src/services/import/zip.js b/src/services/import/zip.js index f79426d20..951ccb306 100644 --- a/src/services/import/zip.js +++ b/src/services/import/zip.js @@ -154,11 +154,6 @@ async function importZip(taskContext, fileBuffer, importRootNote) { continue; } - if (attr.type === 'label' && attr.name === 'externalLink') { - // also created automatically - continue; - } - if (attr.type === 'relation') { attr.value = getNewNoteId(attr.value); } diff --git a/src/services/notes.js b/src/services/notes.js index 59f914503..4a46887c8 100644 --- a/src/services/notes.js +++ b/src/services/notes.js @@ -225,20 +225,6 @@ function findInternalLinks(content, foundLinks) { return content.replace(/href="[^"]*#root/g, 'href="#root'); } -function findExternalLinks(content, foundLinks) { - const re = /href="([a-zA-Z]+:\/\/[^"]*)"/g; - let match; - - while (match = re.exec(content)) { - foundLinks.push({ - name: 'externalLink', - value: match[1] - }); - } - - return content; -} - function findIncludeNoteLinks(content, foundLinks) { const re = /
/g; let match; @@ -392,7 +378,6 @@ async function saveLinks(note, content) { if (note.type === 'text') { content = findImageLinks(content, foundLinks); content = findInternalLinks(content, foundLinks); - content = findExternalLinks(content, foundLinks); content = findIncludeNoteLinks(content, foundLinks); content = await downloadImages(note.noteId, content); @@ -407,11 +392,9 @@ async function saveLinks(note, content) { const existingLinks = await note.getLinks(); for (const foundLink of foundLinks) { - if (foundLink.name !== 'externalLink') { - const targetNote = await repository.getNote(foundLink.value); - if (!targetNote || targetNote.isDeleted) { - continue; - } + const targetNote = await repository.getNote(foundLink.value); + if (!targetNote || targetNote.isDeleted) { + continue; } const existingLink = existingLinks.find(existingLink => @@ -421,7 +404,7 @@ async function saveLinks(note, content) { if (!existingLink) { const newLink = await new Attribute({ noteId: note.noteId, - type: foundLink.name === 'externalLink' ? 'label' : 'relation', + type: 'relation', name: foundLink.name, value: foundLink.value, }).save();