diff --git a/src/addon.ts b/src/addon.ts index f1b6fda..5bed7dc 100644 --- a/src/addon.ts +++ b/src/addon.ts @@ -1,3 +1,4 @@ +import ZoteroToolkit from "zotero-plugin-toolkit"; import hooks from "./hooks"; class Addon { @@ -5,6 +6,7 @@ class Addon { alive: boolean; // Env type, see build.js env: "development" | "production"; + ztoolkit: ZoteroToolkit; locale?: { stringBundle: any; }; @@ -19,6 +21,7 @@ class Addon { this.data = { alive: true, env: __env__, + ztoolkit: new ZoteroToolkit(), }; this.hooks = hooks; } diff --git a/src/index.ts b/src/index.ts index b7b664f..68ca40a 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,4 +1,4 @@ -import ZoteroToolkit, { ZoteroCompat } from "zotero-plugin-toolkit"; +import { ZoteroCompat } from "zotero-plugin-toolkit"; import Addon from "./addon"; import { config } from "../package.json"; @@ -11,8 +11,8 @@ if (!compat.getGlobal("Zotero").AddonTemplate) { _globalThis.Zotero_Tabs = compat.getGlobal("Zotero_Tabs"); _globalThis.window = compat.getGlobal("window"); _globalThis.document = compat.getGlobal("document"); - _globalThis.ztoolkit = new ZoteroToolkit(); _globalThis.addon = new Addon(); + _globalThis.ztoolkit = addon.data.ztoolkit; ztoolkit.Tool.logOptionsGlobal.prefix = `[${config.addonName}]`; ztoolkit.Tool.logOptionsGlobal.disableConsole = addon.data.env === "production";