Skip to content

Commit

Permalink
update dependence
Browse files Browse the repository at this point in the history
unregister entrance manual
  • Loading branch information
shenyutao committed Mar 11, 2024
1 parent e1675ae commit 0918abd
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@
},
"homepage": "https://github.com/syt2/zotero-addons#readme",
"dependencies": {
"zotero-plugin-toolkit": "^2.3.15"
"zotero-plugin-toolkit": "^2.3.25"
},
"devDependencies": {
"@types/node": "^20.10.4",
"@typescript-eslint/eslint-plugin": "^6.14.0",
"@typescript-eslint/eslint-plugin": "^7.1.1",
"@typescript-eslint/parser": "^7.1.1",
"chokidar": "^3.5.3",
"compressing": "^1.10.0",
Expand Down
2 changes: 1 addition & 1 deletion src/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ function onShutdown(): void {
AddonTable.close();
AddonInfoDetail.close();
AddonListenerManager.removeListener();
document.querySelector("#zotero-toolbaritem-addons")?.remove();
AddonTable.unregisterAll();
// Remove addon object
addon.data.alive = false;
delete Zotero[config.addonInstance];
Expand Down
10 changes: 10 additions & 0 deletions src/modules/addonTable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,11 @@ export class AddonTable {
static registerInMenuTool() {
ztoolkit.Menu.register("menuTools", {
tag: "menuseparator",
id: "addon-table-menuseparator-1"
});
ztoolkit.Menu.register("menuTools", {
tag: "menuitem",
id: "addon-table-entrance",
label: getString("menuitem-addons"),
commandListener: (event) => {
(async () => {
Expand All @@ -61,6 +63,7 @@ export class AddonTable {
});
ztoolkit.Menu.register("menuTools", {
tag: "menuseparator",
id: "addon-table-menuseparator-2"
});
}

Expand Down Expand Up @@ -90,6 +93,13 @@ export class AddonTable {
toolbar.insertBefore(newNode, searchNode);
}

static unregisterAll() {
document.querySelector("#zotero-toolbaritem-addons")?.remove();
ztoolkit.Menu.unregister("addon-table-menuseparator-1");
ztoolkit.Menu.unregister("addon-table-entrance");
ztoolkit.Menu.unregister("addon-table-menuseparator-2");
}

/**
* Check for incompatible plugins when launching for the first time on a new Zotero version
*/
Expand Down

0 comments on commit 0918abd

Please sign in to comment.