diff --git a/src/public/javascripts/services/tab_manager.js b/src/public/javascripts/services/tab_manager.js index c2931bc92..c7823a5b1 100644 --- a/src/public/javascripts/services/tab_manager.js +++ b/src/public/javascripts/services/tab_manager.js @@ -204,7 +204,8 @@ export default class TabManager extends Component { async activateOrOpenNote(noteId) { for (const tabContext of this.getTabContexts()) { if (tabContext.note && tabContext.note.noteId === noteId) { - await tabContext.activate(); + this.activateTab(tabContext.tabId); + return; } } diff --git a/src/routes/api/clipper.js b/src/routes/api/clipper.js index 986268c7a..8e415b931 100644 --- a/src/routes/api/clipper.js +++ b/src/routes/api/clipper.js @@ -55,7 +55,9 @@ async function addClipping(req) { const rewrittenContent = await addImagesToNote(images, clippingNote, content); - await clippingNote.setContent(await clippingNote.getContent() + '

' + rewrittenContent + '

'); + const existingContent = await clippingNote.getContent(); + + await clippingNote.setContent(existingContent + (existingContent.trim() ? "
" : "") + rewrittenContent); return { noteId: clippingNote.noteId diff --git a/src/services/notes.js b/src/services/notes.js index bdfe5ef34..59f914503 100644 --- a/src/services/notes.js +++ b/src/services/notes.js @@ -419,12 +419,14 @@ async function saveLinks(note, content) { && existingLink.name === foundLink.name); if (!existingLink) { - await new Attribute({ + const newLink = await new Attribute({ noteId: note.noteId, type: foundLink.name === 'externalLink' ? 'label' : 'relation', name: foundLink.name, value: foundLink.value, }).save(); + + existingLinks.push(newLink); } else if (existingLink.isDeleted) { existingLink.isDeleted = false;