From 887d71487e7e0474ff0550957986333a260f60df Mon Sep 17 00:00:00 2001 From: windingwind <33902321+windingwind@users.noreply.github.com> Date: Sun, 8 Sep 2024 16:52:27 +0200 Subject: [PATCH] update: ztoolkit v3 --- package-lock.json | 8 ++++---- package.json | 2 +- src/modules/export/freemind.ts | 7 ++++--- src/utils/link.ts | 4 +--- src/utils/ztoolkit.ts | 6 ------ 5 files changed, 10 insertions(+), 17 deletions(-) diff --git a/package-lock.json b/package-lock.json index 6eae84b..89fcfdc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -35,7 +35,7 @@ "unist-util-visit": "^5.0.0", "unist-util-visit-parents": "^6.0.1", "yamljs": "^0.3.0", - "zotero-plugin-toolkit": "^2.3.37" + "zotero-plugin-toolkit": "^3.0.2" }, "devDependencies": { "@esbuild-plugins/node-globals-polyfill": "^0.2.3", @@ -14400,9 +14400,9 @@ } }, "node_modules/zotero-plugin-toolkit": { - "version": "2.3.37", - "resolved": "https://registry.npmjs.org/zotero-plugin-toolkit/-/zotero-plugin-toolkit-2.3.37.tgz", - "integrity": "sha512-C1e9o+pWR8vPJQaGpHPDKEsWcTJwjef90vX+kQQ6aDlXYNomhtHNXHmweIQWoufNQz26wQQkFFU1zkvIQ4Ff6A==", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/zotero-plugin-toolkit/-/zotero-plugin-toolkit-3.0.2.tgz", + "integrity": "sha512-99WKlyBRt1bMj+4w7ZY6mMsrHJiuTfOtM9ev2U2qUb8qK8x4/050H7jq7dR0B53udPY95G3IIwXn18LQdylGnw==", "dependencies": { "zotero-types": "^2.0.3" } diff --git a/package.json b/package.json index a5b5e34..0300809 100644 --- a/package.json +++ b/package.json @@ -56,7 +56,7 @@ "unist-util-visit": "^5.0.0", "unist-util-visit-parents": "^6.0.1", "yamljs": "^0.3.0", - "zotero-plugin-toolkit": "^2.3.37" + "zotero-plugin-toolkit": "^3.0.2" }, "devDependencies": { "@esbuild-plugins/node-globals-polyfill": "^0.2.3", diff --git a/src/modules/export/freemind.ts b/src/modules/export/freemind.ts index 573a336..1950fdd 100644 --- a/src/modules/export/freemind.ts +++ b/src/modules/export/freemind.ts @@ -25,9 +25,10 @@ async function note2mm( }; let lines: string[] = []; if (options.withContent) { - const doc = ztoolkit - .getDOMParser() - .parseFromString(await renderNoteHTML(noteItem), "text/html"); + const doc = new DOMParser().parseFromString( + await renderNoteHTML(noteItem), + "text/html", + ); textNodeForEach(doc.body, (e: Text) => { e.data = htmlEscape(doc, e.data); }); diff --git a/src/utils/link.ts b/src/utils/link.ts index 7474828..3a01c45 100644 --- a/src/utils/link.ts +++ b/src/utils/link.ts @@ -94,9 +94,7 @@ export function getLinkedNotesRecursively( if (ignoreIds.includes(noteItem.id)) { return []; } - const doc = ztoolkit - .getDOMParser() - .parseFromString(noteItem.getNote(), "text/html"); + const doc = new DOMParser().parseFromString(noteItem.getNote(), "text/html"); const links = Array.from(doc.querySelectorAll("a")); return links.reduce( (acc, link) => { diff --git a/src/utils/ztoolkit.ts b/src/utils/ztoolkit.ts index 1cc3526..b084fad 100644 --- a/src/utils/ztoolkit.ts +++ b/src/utils/ztoolkit.ts @@ -34,18 +34,14 @@ import { DialogHelper } from "zotero-plugin-toolkit/dist/helpers/dialog"; import { FilePickerHelper } from "zotero-plugin-toolkit/dist/helpers/filePicker"; import { ProgressWindowHelper } from "zotero-plugin-toolkit/dist/helpers/progressWindow"; import { VirtualizedTableHelper } from "zotero-plugin-toolkit/dist/helpers/virtualizedTable"; -import { LibraryTabPanelManager } from "zotero-plugin-toolkit/dist/managers/libraryTabPanel"; import { MenuManager } from "zotero-plugin-toolkit/dist/managers/menu"; import { PromptManager } from "zotero-plugin-toolkit/dist/managers/prompt"; -import { ReaderTabPanelManager } from "zotero-plugin-toolkit/dist/managers/readerTabPanel"; import { LargePrefHelper } from "zotero-plugin-toolkit/dist/helpers/largePref"; import { GuideHelper } from "zotero-plugin-toolkit/dist/helpers/guide"; class MyToolkit extends BasicTool { UI: UITool; Prompt: PromptManager; - LibraryTabPanel: LibraryTabPanelManager; - ReaderTabPanel: ReaderTabPanelManager; Menu: MenuManager; Clipboard: typeof ClipboardHelper; FilePicker: typeof FilePickerHelper; @@ -59,8 +55,6 @@ class MyToolkit extends BasicTool { super(); this.UI = new UITool(this); this.Prompt = new PromptManager(this); - this.LibraryTabPanel = new LibraryTabPanelManager(this); - this.ReaderTabPanel = new ReaderTabPanelManager(this); this.Menu = new MenuManager(this); this.Clipboard = ClipboardHelper; this.FilePicker = FilePickerHelper;