fix: index.ts import

This commit is contained in:
xiangyu 2023-01-05 20:07:27 +08:00
parent 626cff548b
commit aa9763e9a9

View File

@ -1,15 +1,16 @@
import ZoteroToolkit from "zotero-plugin-toolkit"; import ZoteroToolkit, { ZoteroCompat } from "zotero-plugin-toolkit";
import { getGlobal } from "zotero-plugin-toolkit/dist/utils";
import Addon from "./addon"; import Addon from "./addon";
import { config } from "../package.json"; import { config } from "../package.json";
if (!getGlobal("Zotero").AddonTemplate) { const compat = new ZoteroCompat();
if (!compat.getGlobal("Zotero").AddonTemplate) {
// Set global variables // Set global variables
_globalThis.Zotero = getGlobal("Zotero"); _globalThis.Zotero = compat.getGlobal("Zotero");
_globalThis.ZoteroPane = getGlobal("ZoteroPane"); _globalThis.ZoteroPane = compat.getGlobal("ZoteroPane");
_globalThis.Zotero_Tabs = getGlobal("Zotero_Tabs"); _globalThis.Zotero_Tabs = compat.getGlobal("Zotero_Tabs");
_globalThis.window = getGlobal("window"); _globalThis.window = compat.getGlobal("window");
_globalThis.document = getGlobal("document"); _globalThis.document = compat.getGlobal("document");
_globalThis.ztoolkit = new ZoteroToolkit(); _globalThis.ztoolkit = new ZoteroToolkit();
_globalThis.addon = new Addon(); _globalThis.addon = new Addon();
ztoolkit.Tool.logOptionsGlobal.prefix = `[${config.addonName}]`; ztoolkit.Tool.logOptionsGlobal.prefix = `[${config.addonName}]`;