update: toolkit 2.0.0

This commit is contained in:
windingwind 2023-02-07 22:56:00 +08:00
parent e2112995ad
commit 296f03944a
6 changed files with 23 additions and 13 deletions

10
.vscode/launch.json vendored
View File

@ -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"
],
}
]
}

View File

@ -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"
}
}
}

View File

@ -130,7 +130,7 @@ function onShortcuts(type: string) {
KeyExampleFactory.exampleShortcutSmallerCallback();
break;
case "confliction":
KeyExampleFactory.exampleShortcutConflictionCallback();
KeyExampleFactory.exampleShortcutConflictingCallback();
break;
default:
break;

View File

@ -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();

View File

@ -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"

View File

@ -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`,