From 296f03944a616d887388e7a6b363b27863f56497 Mon Sep 17 00:00:00 2001 From: windingwind Date: Tue, 7 Feb 2023 22:56:00 +0800 Subject: [PATCH] update: toolkit 2.0.0 --- .vscode/launch.json | 10 ++++++++-- package.json | 4 ++-- src/hooks.ts | 2 +- src/index.ts | 4 ++++ src/modules/examples.ts | 14 +++++++------- src/modules/preferenceScript.ts | 2 +- 6 files changed, 23 insertions(+), 13 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 1b6e48b..dac8cca 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -9,14 +9,20 @@ "request": "launch", "name": "Restart", "runtimeExecutable": "npm", - "runtimeArgs": ["run", "restart"], + "runtimeArgs": [ + "run", + "restart" + ], }, { "type": "node", "request": "launch", "name": "Restart in Prod Mode", "runtimeExecutable": "npm", - "runtimeArgs": ["run", "restart-prod"], + "runtimeArgs": [ + "run", + "restart-prod" + ], } ] } \ No newline at end of file diff --git a/package.json b/package.json index 1f4ca32..1c7d059 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,7 @@ }, "homepage": "https://github.com/windingwind/zotero-addon-template#readme", "dependencies": { - "zotero-plugin-toolkit": "^1.1.1" + "zotero-plugin-toolkit": "^2.0.0" }, "devDependencies": { "@types/node": "^18.11.17", @@ -51,4 +51,4 @@ "typescript": "^4.9.4", "zotero-types": "^1.0.6" } -} +} \ No newline at end of file diff --git a/src/hooks.ts b/src/hooks.ts index a9f8817..81ceab6 100644 --- a/src/hooks.ts +++ b/src/hooks.ts @@ -130,7 +130,7 @@ function onShortcuts(type: string) { KeyExampleFactory.exampleShortcutSmallerCallback(); break; case "confliction": - KeyExampleFactory.exampleShortcutConflictionCallback(); + KeyExampleFactory.exampleShortcutConflictingCallback(); break; default: break; diff --git a/src/index.ts b/src/index.ts index 84198ad..5326e2b 100644 --- a/src/index.ts +++ b/src/index.ts @@ -17,6 +17,10 @@ if (!basicTool.getGlobal("Zotero")[config.addonInstance]) { ztoolkit.basicOptions.log.disableConsole = addon.data.env === "production"; ztoolkit.UI.basicOptions.ui.enableElementJSONLog = addon.data.env === "development"; + ztoolkit.UI.basicOptions.ui.enableElementDOMLog = + addon.data.env === "development"; + ztoolkit.basicOptions.debug.disableDebugBridgePassword = + addon.data.env === "development"; Zotero[config.addonInstance] = addon; // Trigger addon hook for initialization addon.hooks.onStartup(); diff --git a/src/modules/examples.ts b/src/modules/examples.ts index c867183..3eaac57 100644 --- a/src/modules/examples.ts +++ b/src/modules/examples.ts @@ -165,16 +165,16 @@ export class KeyExampleFactory { } @example - static exampleShortcutConflictionCallback() { - const conflictionGroups = ztoolkit.Shortcut.checkAllKeyConfliction(); - new ztoolkit.ProgressWindow("Check Key Confliction") + static exampleShortcutConflictingCallback() { + const conflictingGroups = ztoolkit.Shortcut.checkAllKeyConflicting(); + new ztoolkit.ProgressWindow("Check Key Conflicting") .createLine({ - text: `${conflictionGroups.length} groups of confliction keys found. Details are in the debug output/console.`, + text: `${conflictingGroups.length} groups of conflicting keys found. Details are in the debug output/console.`, }) .show(-1); ztoolkit.log( - "Conflictions:", - conflictionGroups, + "Conflicting:", + conflictingGroups, "All keys:", ztoolkit.Shortcut.getAll() ); @@ -667,7 +667,7 @@ export class HelperExampleFactory { @example static clipboardExample() { - new ztoolkit.Clibpoard() + new ztoolkit.Clipboard() .addText( "![Plugin Template](https://github.com/windingwind/zotero-plugin-template)", "text/unicode" diff --git a/src/modules/preferenceScript.ts b/src/modules/preferenceScript.ts index 348ffb1..5ed7d23 100644 --- a/src/modules/preferenceScript.ts +++ b/src/modules/preferenceScript.ts @@ -46,7 +46,7 @@ async function updatePrefsUI() { // with addon.data.prefs.window.document // Or bind some events to the elements const renderLock = ztoolkit.getGlobal("Zotero").Promise.defer(); - const tableHelper = new ztoolkit.VirtualizedTabel(addon.data.prefs?.window!) + const tableHelper = new ztoolkit.VirtualizedTable(addon.data.prefs?.window!) .setContainerId(`${config.addonRef}-table-container`) .setProp({ id: `${config.addonRef}-prefs-table`,