update: make toolkit accessible
This commit is contained in:
parent
f87cdfa1ef
commit
d42abcbfcc
@ -1,3 +1,4 @@
|
|||||||
|
import ZoteroToolkit from "zotero-plugin-toolkit";
|
||||||
import hooks from "./hooks";
|
import hooks from "./hooks";
|
||||||
|
|
||||||
class Addon {
|
class Addon {
|
||||||
@ -5,6 +6,7 @@ class Addon {
|
|||||||
alive: boolean;
|
alive: boolean;
|
||||||
// Env type, see build.js
|
// Env type, see build.js
|
||||||
env: "development" | "production";
|
env: "development" | "production";
|
||||||
|
ztoolkit: ZoteroToolkit;
|
||||||
locale?: {
|
locale?: {
|
||||||
stringBundle: any;
|
stringBundle: any;
|
||||||
};
|
};
|
||||||
@ -19,6 +21,7 @@ class Addon {
|
|||||||
this.data = {
|
this.data = {
|
||||||
alive: true,
|
alive: true,
|
||||||
env: __env__,
|
env: __env__,
|
||||||
|
ztoolkit: new ZoteroToolkit(),
|
||||||
};
|
};
|
||||||
this.hooks = hooks;
|
this.hooks = hooks;
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import ZoteroToolkit, { ZoteroCompat } from "zotero-plugin-toolkit";
|
import { ZoteroCompat } from "zotero-plugin-toolkit";
|
||||||
import Addon from "./addon";
|
import Addon from "./addon";
|
||||||
import { config } from "../package.json";
|
import { config } from "../package.json";
|
||||||
|
|
||||||
@ -11,8 +11,8 @@ if (!compat.getGlobal("Zotero").AddonTemplate) {
|
|||||||
_globalThis.Zotero_Tabs = compat.getGlobal("Zotero_Tabs");
|
_globalThis.Zotero_Tabs = compat.getGlobal("Zotero_Tabs");
|
||||||
_globalThis.window = compat.getGlobal("window");
|
_globalThis.window = compat.getGlobal("window");
|
||||||
_globalThis.document = compat.getGlobal("document");
|
_globalThis.document = compat.getGlobal("document");
|
||||||
_globalThis.ztoolkit = new ZoteroToolkit();
|
|
||||||
_globalThis.addon = new Addon();
|
_globalThis.addon = new Addon();
|
||||||
|
_globalThis.ztoolkit = addon.data.ztoolkit;
|
||||||
ztoolkit.Tool.logOptionsGlobal.prefix = `[${config.addonName}]`;
|
ztoolkit.Tool.logOptionsGlobal.prefix = `[${config.addonName}]`;
|
||||||
ztoolkit.Tool.logOptionsGlobal.disableConsole =
|
ztoolkit.Tool.logOptionsGlobal.disableConsole =
|
||||||
addon.data.env === "production";
|
addon.data.env === "production";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user