From 60a5ea897491ff58ad690c527ef6fb1f0f2376a0 Mon Sep 17 00:00:00 2001 From: windingwind <33902321+windingwind@users.noreply.github.com> Date: Fri, 23 Aug 2024 18:51:52 +0800 Subject: [PATCH] fix: should create new note from annotation if the linked one is deleted fix: #1076 --- src/modules/reader.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/modules/reader.ts b/src/modules/reader.ts index c348f4e..e970558 100644 --- a/src/modules/reader.ts +++ b/src/modules/reader.ts @@ -70,7 +70,7 @@ async function createNoteFromAnnotation( for (const tag of annotationTags) { if (linkRegex.test(tag)) { const linkParams = getNoteLinkParams(tag); - if (linkParams.noteItem) { + if (linkParams.noteItem && linkParams.noteItem.isNote()) { addon.hooks.onOpenNote(linkParams.noteItem.id, openMode || "tab", { lineIndex: linkParams.lineIndex || undefined, }); @@ -101,9 +101,10 @@ async function createNoteFromAnnotation( linkTarget.toLibID, linkTarget.toKey, ); - if (targetItem) + if (targetItem) { addon.hooks.onOpenNote(targetItem.id, openMode || "builtin", {}); - return; + return; + } } const note: Zotero.Item = new Zotero.Item("note");