diff --git a/addon/chrome/content/workspace.xul b/addon/chrome/content/workspace.xul
index cd7b034..8ce9db1 100644
--- a/addon/chrome/content/workspace.xul
+++ b/addon/chrome/content/workspace.xul
@@ -29,6 +29,7 @@
"); + + for (const note of notes) { + const linkURL = this._Addon.knowledge.getNoteLink(note); + const linkText = note.getNoteTitle().trim(); + newLines.push( + `
${linkText ? linkText : linkURL}
` + ); + newLines.push(""); + } + // End of line + await this._Addon.knowledge.addLinesToNote(undefined, newLines, 65535); } else if (message.type === "export") { /* message.content = { diff --git a/src/knowledge.ts b/src/knowledge.ts index bd117eb..3b4f255 100644 --- a/src/knowledge.ts +++ b/src/knowledge.ts @@ -358,20 +358,12 @@ class Knowledge extends AddonBase { this._Addon.views.showProgressWindow("Better Notes", "Not a note item"); return; } - let libraryID = linkedNote.libraryID; - let library = Zotero.Libraries.get(libraryID); - let groupID: string; - if (library.libraryType === "user") { - groupID = "u"; - } else if (library.libraryType === "group") { - groupID = `${library.id}`; - } - let noteKey = linkedNote.key; - let linkText = linkedNote.getNoteTitle().trim(); + const link = this.getNoteLink(linkedNote); + const linkText = linkedNote.getNoteTitle().trim(); this.addSubLineToNote( targetNote, - `${ - linkText ? linkText : `zotero://note/${groupID}/${noteKey}/` + `${ + linkText ? linkText : `${link}` }`, lineIndex, true @@ -382,6 +374,19 @@ class Knowledge extends AddonBase { ); } + getNoteLink(note: ZoteroItem) { + let libraryID = note.libraryID; + let library = Zotero.Libraries.get(libraryID); + let groupID: string; + if (library.libraryType === "user") { + groupID = "u"; + } else if (library.libraryType === "group") { + groupID = `${library.id}`; + } + let noteKey = note.key; + return `zotero://note/${groupID}/${noteKey}/`; + } + async modifyLineInNote(note: ZoteroItem, text: string, lineIndex: number) { note = note || this.getWorkspaceNote(); if (!note) {