chore(deps): update deps
This commit is contained in:
parent
62cdaf9c4d
commit
b8924c7e1f
|
|
@ -5,4 +5,5 @@ pnpm-lock.yaml
|
||||||
yarn.lock
|
yarn.lock
|
||||||
zotero-cmd.json
|
zotero-cmd.json
|
||||||
.DS_Store
|
.DS_Store
|
||||||
.env
|
.env
|
||||||
|
.scaffold
|
||||||
File diff suppressed because it is too large
Load Diff
42
package.json
42
package.json
|
|
@ -31,16 +31,16 @@
|
||||||
},
|
},
|
||||||
"homepage": "https://github.com/windingwind/zotero-better-notes#readme",
|
"homepage": "https://github.com/windingwind/zotero-better-notes#readme",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"asciidoctor": "^3.0.2",
|
"asciidoctor": "^3.0.4",
|
||||||
"dexie": "^4.0.4",
|
"dexie": "^4.0.10",
|
||||||
"diff": "^5.1.0",
|
"diff": "^5.2.0",
|
||||||
"hast-util-to-html": "^9.0.0",
|
"hast-util-to-html": "^9.0.4",
|
||||||
"hast-util-to-mdast": "^8.4.1",
|
"hast-util-to-mdast": "^8.4.1",
|
||||||
"hast-util-to-text": "^4.0.0",
|
"hast-util-to-text": "^4.0.2",
|
||||||
"hastscript": "^8.0.0",
|
"hastscript": "^8.0.0",
|
||||||
"html-docx-js": "^0.3.1",
|
"html-docx-js": "^0.3.1",
|
||||||
"html-docx-js-typescript": "^0.1.5",
|
"html-docx-js-typescript": "^0.1.5",
|
||||||
"katex": "^0.16.9",
|
"katex": "^0.16.19",
|
||||||
"path-browserify": "^1.0.1",
|
"path-browserify": "^1.0.1",
|
||||||
"rehype-format": "^4.0.1",
|
"rehype-format": "^4.0.1",
|
||||||
"rehype-parse": "^8.0.5",
|
"rehype-parse": "^8.0.5",
|
||||||
|
|
@ -57,38 +57,38 @@
|
||||||
"unist-util-visit": "^5.0.0",
|
"unist-util-visit": "^5.0.0",
|
||||||
"unist-util-visit-parents": "^6.0.1",
|
"unist-util-visit-parents": "^6.0.1",
|
||||||
"yamljs": "^0.3.0",
|
"yamljs": "^0.3.0",
|
||||||
"zotero-plugin-toolkit": "^4.0.11"
|
"zotero-plugin-toolkit": "^4.1.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@esbuild-plugins/node-globals-polyfill": "^0.2.3",
|
"@esbuild-plugins/node-globals-polyfill": "^0.2.3",
|
||||||
"@prettier/plugin-xml": "^3.2.2",
|
"@prettier/plugin-xml": "^3.4.1",
|
||||||
"@types/browser-or-node": "^1.3.2",
|
"@types/browser-or-node": "^1.3.2",
|
||||||
"@types/chai": "^5.0.1",
|
"@types/chai": "^5.0.1",
|
||||||
"@types/diff": "^5.0.9",
|
"@types/diff": "^5.2.3",
|
||||||
"@types/html-docx-js": "^0.3.4",
|
"@types/html-docx-js": "^0.3.4",
|
||||||
"@types/katex": "^0.16.7",
|
"@types/katex": "^0.16.7",
|
||||||
"@types/mocha": "^10.0.10",
|
"@types/mocha": "^10.0.10",
|
||||||
"@types/node": "^20.10.4",
|
"@types/node": "^20.17.10",
|
||||||
"@types/path-browserify": "^1.0.2",
|
"@types/path-browserify": "^1.0.3",
|
||||||
"@types/seedrandom": "^3.0.8",
|
"@types/seedrandom": "^3.0.8",
|
||||||
"@types/yamljs": "^0.2.34",
|
"@types/yamljs": "^0.2.34",
|
||||||
"@typescript-eslint/eslint-plugin": "^6.14.0",
|
"@typescript-eslint/eslint-plugin": "^6.21.0",
|
||||||
"@typescript-eslint/parser": "^6.14.0",
|
"@typescript-eslint/parser": "^6.21.0",
|
||||||
"chokidar-cli": "^3.0.0",
|
"chokidar-cli": "^3.0.0",
|
||||||
"concurrently": "^8.2.2",
|
"concurrently": "^8.2.2",
|
||||||
"cross-env": "^7.0.3",
|
"cross-env": "^7.0.3",
|
||||||
"eslint": "^8.56.0",
|
"eslint": "^8.57.1",
|
||||||
"eslint-config-prettier": "^9.1.0",
|
"eslint-config-prettier": "^9.1.0",
|
||||||
"prettier": "^3.1.1",
|
"prettier": "^3.4.2",
|
||||||
"prosemirror-model": "^1.19.4",
|
"prosemirror-model": "^1.24.1",
|
||||||
"prosemirror-state": "^1.4.3",
|
"prosemirror-state": "^1.4.3",
|
||||||
"prosemirror-transform": "^1.8.0",
|
"prosemirror-transform": "^1.10.2",
|
||||||
"prosemirror-view": "^1.32.6",
|
"prosemirror-view": "^1.37.1",
|
||||||
"replace-in-file": "^7.2.0",
|
"replace-in-file": "^7.2.0",
|
||||||
"typescript": "^5.3.3",
|
"typescript": "^5.7.2",
|
||||||
"xslt3": "^2.6.0",
|
"xslt3": "^2.7.0",
|
||||||
"zotero-plugin-scaffold": "^0.2.0-beta.5",
|
"zotero-plugin-scaffold": "^0.2.0-beta.5",
|
||||||
"zotero-types": "^3.0.2"
|
"zotero-types": "^3.1.0"
|
||||||
},
|
},
|
||||||
"eslintConfig": {
|
"eslintConfig": {
|
||||||
"env": {
|
"env": {
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ class Addon {
|
||||||
window: Window;
|
window: Window;
|
||||||
};
|
};
|
||||||
export: {
|
export: {
|
||||||
pdf: { promise?: _ZoteroTypes.PromiseObject };
|
pdf: { promise?: _ZoteroTypes.Promise.PromiseObject };
|
||||||
};
|
};
|
||||||
sync: {
|
sync: {
|
||||||
data?: LargePrefHelper;
|
data?: LargePrefHelper;
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ export class PluginCEBase extends XULElementBase {
|
||||||
useShadowRoot = false;
|
useShadowRoot = false;
|
||||||
|
|
||||||
connectedCallback(): void {
|
connectedCallback(): void {
|
||||||
|
// @ts-ignore - plugin instance
|
||||||
this._addon = Zotero[config.addonInstance];
|
this._addon = Zotero[config.addonInstance];
|
||||||
Zotero.UIProperties.registerRoot(this);
|
Zotero.UIProperties.registerRoot(this);
|
||||||
if (!this.useShadowRoot) {
|
if (!this.useShadowRoot) {
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ let io: {
|
||||||
};
|
};
|
||||||
accepted: boolean;
|
accepted: boolean;
|
||||||
useBuiltInExport: boolean;
|
useBuiltInExport: boolean;
|
||||||
deferred: _ZoteroTypes.DeferredPromise<void>;
|
deferred: _ZoteroTypes.Promise.DeferredPromise<void>;
|
||||||
embedLink: boolean;
|
embedLink: boolean;
|
||||||
standaloneLink: boolean;
|
standaloneLink: boolean;
|
||||||
exportNote: boolean;
|
exportNote: boolean;
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ let io: {
|
||||||
currentNoteID: number;
|
currentNoteID: number;
|
||||||
currentLineIndex?: number;
|
currentLineIndex?: number;
|
||||||
openedNoteIDs?: number[];
|
openedNoteIDs?: number[];
|
||||||
deferred: _ZoteroTypes.DeferredPromise<void>;
|
deferred: _ZoteroTypes.Promise.DeferredPromise<void>;
|
||||||
|
|
||||||
targetNoteID?: number;
|
targetNoteID?: number;
|
||||||
content?: string;
|
content?: string;
|
||||||
|
|
@ -40,7 +40,7 @@ window.onunload = function () {
|
||||||
function init() {
|
function init() {
|
||||||
// Set font size from pref
|
// Set font size from pref
|
||||||
const sbc = document.getElementById("top-container");
|
const sbc = document.getElementById("top-container");
|
||||||
Zotero.UIProperties.registerRoot(sbc);
|
Zotero.UIProperties.registerRoot(sbc!);
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
const size = ((getPref("windows.linkCreator.size") as string) || "").split(
|
const size = ((getPref("windows.linkCreator.size") as string) || "").split(
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@ function accept() {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @ts-ignore - plugin instance
|
||||||
const getString = (Zotero[config.addonRef] as typeof addon).api.utils.getString;
|
const getString = (Zotero[config.addonRef] as typeof addon).api.utils.getString;
|
||||||
|
|
||||||
function initTable() {
|
function initTable() {
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,7 @@ import { showUserGuide } from "./modules/userGuide";
|
||||||
import { refreshTemplatesInNote } from "./modules/template/refresh";
|
import { refreshTemplatesInNote } from "./modules/template/refresh";
|
||||||
import { closeParsingServer } from "./utils/parsing";
|
import { closeParsingServer } from "./utils/parsing";
|
||||||
import { patchExportItems } from "./modules/exportItems";
|
import { patchExportItems } from "./modules/exportItems";
|
||||||
|
import { patchOpenTabMenu } from "./modules/openTabMenu";
|
||||||
|
|
||||||
async function onStartup() {
|
async function onStartup() {
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
|
|
@ -79,7 +80,7 @@ async function onStartup() {
|
||||||
|
|
||||||
setSyncing();
|
setSyncing();
|
||||||
|
|
||||||
await onMainWindowLoad(Zotero.getMainWindow());
|
await Promise.all(Zotero.getMainWindows().map(onMainWindowLoad));
|
||||||
|
|
||||||
// For testing
|
// For testing
|
||||||
addon.data.initialized = true;
|
addon.data.initialized = true;
|
||||||
|
|
@ -105,7 +106,9 @@ async function onMainWindowLoad(win: _ZoteroTypes.MainWindow): Promise<void> {
|
||||||
|
|
||||||
patchExportItems(win);
|
patchExportItems(win);
|
||||||
|
|
||||||
restoreNoteTabs();
|
patchOpenTabMenu(win);
|
||||||
|
|
||||||
|
await restoreNoteTabs();
|
||||||
|
|
||||||
showUserGuide(win);
|
showUserGuide(win);
|
||||||
}
|
}
|
||||||
|
|
@ -120,6 +123,7 @@ function onShutdown(): void {
|
||||||
ztoolkit.unregisterAll();
|
ztoolkit.unregisterAll();
|
||||||
// Remove addon object
|
// Remove addon object
|
||||||
addon.data.alive = false;
|
addon.data.alive = false;
|
||||||
|
// @ts-ignore plugin instance
|
||||||
delete Zotero[config.addonInstance];
|
delete Zotero[config.addonInstance];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -300,6 +304,5 @@ export default {
|
||||||
onCreateNoteFromTemplate,
|
onCreateNoteFromTemplate,
|
||||||
onCreateNoteFromMD,
|
onCreateNoteFromMD,
|
||||||
onCreateNote,
|
onCreateNote,
|
||||||
restoreNoteTabs,
|
|
||||||
onShowUserGuide,
|
onShowUserGuide,
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import { config } from "../package.json";
|
||||||
|
|
||||||
const basicTool = new BasicTool();
|
const basicTool = new BasicTool();
|
||||||
|
|
||||||
|
// @ts-ignore - plugin instance
|
||||||
if (!basicTool.getGlobal("Zotero")[config.addonInstance]) {
|
if (!basicTool.getGlobal("Zotero")[config.addonInstance]) {
|
||||||
// Set global variables
|
// Set global variables
|
||||||
defineGlobal("window");
|
defineGlobal("window");
|
||||||
|
|
@ -16,6 +17,7 @@ if (!basicTool.getGlobal("Zotero")[config.addonInstance]) {
|
||||||
return _globalThis.addon.data.ztoolkit;
|
return _globalThis.addon.data.ztoolkit;
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
// @ts-ignore - plugin instance
|
||||||
Zotero[config.addonInstance] = addon;
|
Zotero[config.addonInstance] = addon;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ export function patchExportItems(win: _ZoteroTypes.MainWindow) {
|
||||||
const Zotero_File_Interface = win.Zotero_File_Interface;
|
const Zotero_File_Interface = win.Zotero_File_Interface;
|
||||||
new PatchHelper().setData({
|
new PatchHelper().setData({
|
||||||
target: Zotero_File_Interface,
|
target: Zotero_File_Interface,
|
||||||
funcSign: "exportItems",
|
funcSign: "exportItems" as any,
|
||||||
patcher: (origin) =>
|
patcher: (origin) =>
|
||||||
function () {
|
function () {
|
||||||
if (!getPref("exportNotes.takeover")) {
|
if (!getPref("exportNotes.takeover")) {
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,170 @@
|
||||||
|
export function patchOpenTabMenu(win: _ZoteroTypes.MainWindow) {
|
||||||
|
const Zotero_Tabs = win.Zotero_Tabs;
|
||||||
|
const popupset = win.document.querySelector("popupset")!;
|
||||||
|
const observer = new win.MutationObserver(async () => {
|
||||||
|
await new Promise((resolve) =>
|
||||||
|
requestIdleCallback(resolve, { timeout: 100 }),
|
||||||
|
);
|
||||||
|
// Find menupopup menuitem[label="${Zotero.getString('general.showInLibrary')}"]
|
||||||
|
const menupopup = popupset.querySelector(
|
||||||
|
`menupopup menuitem[label="${Zotero.getString("tabs.move")}"]`,
|
||||||
|
)?.parentNode as XULPopupElement;
|
||||||
|
ztoolkit.log("openTabMenu observer", popupset.children);
|
||||||
|
if (menupopup && !menupopup.dataset.patched) {
|
||||||
|
menupopup.dataset.patched = "true";
|
||||||
|
const menuitem = menupopup.querySelector(
|
||||||
|
`menuitem[label="${Zotero.getString("general.showInLibrary")}"]`,
|
||||||
|
);
|
||||||
|
ztoolkit.log("openTabMenu observer");
|
||||||
|
|
||||||
|
menuitem?.addEventListener("command", () => {
|
||||||
|
const { tab } = Zotero_Tabs._getTab(Zotero_Tabs.selectedID);
|
||||||
|
if (tab && tab.type === "note") {
|
||||||
|
let itemID = tab.data.itemID;
|
||||||
|
const item = Zotero.Items.get(itemID);
|
||||||
|
if (item && item.parentItemID) {
|
||||||
|
itemID = item.parentItemID;
|
||||||
|
}
|
||||||
|
win.ZoteroPane.selectItem(itemID);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// observer.disconnect();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
observer.observe(popupset, { childList: true, subtree: true });
|
||||||
|
}
|
||||||
|
|
||||||
|
function openNoteTabMenu(
|
||||||
|
x: number,
|
||||||
|
y: number,
|
||||||
|
id: string,
|
||||||
|
win: _ZoteroTypes.MainWindow,
|
||||||
|
) {
|
||||||
|
const Zotero_Tabs = win.Zotero_Tabs;
|
||||||
|
const doc = win.document;
|
||||||
|
const { tab, tabIndex } = Zotero_Tabs._getTab(id);
|
||||||
|
let menuitem;
|
||||||
|
const popup = doc.createXULElement("menupopup") as XULPopupElement;
|
||||||
|
doc.querySelector("popupset")!.appendChild(popup);
|
||||||
|
popup.addEventListener("popuphidden", function (event) {
|
||||||
|
if (event.target === popup) {
|
||||||
|
popup.remove();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (id !== "zotero-pane") {
|
||||||
|
// Show in library
|
||||||
|
menuitem = doc.createXULElement("menuitem");
|
||||||
|
menuitem.setAttribute("label", Zotero.getString("general.showInLibrary"));
|
||||||
|
menuitem.addEventListener("command", () => {
|
||||||
|
if (tab) {
|
||||||
|
let itemID = tab.data.itemID;
|
||||||
|
const item = Zotero.Items.get(itemID);
|
||||||
|
if (item && item.parentItemID) {
|
||||||
|
itemID = item.parentItemID;
|
||||||
|
}
|
||||||
|
ZoteroPane_Local.selectItem(itemID);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
popup.appendChild(menuitem);
|
||||||
|
// Move tab
|
||||||
|
const menu = doc.createXULElement("menu");
|
||||||
|
menu.setAttribute("label", Zotero.getString("tabs.move"));
|
||||||
|
const menupopup = doc.createXULElement("menupopup");
|
||||||
|
menu.append(menupopup);
|
||||||
|
popup.appendChild(menu);
|
||||||
|
// Move to start
|
||||||
|
menuitem = doc.createXULElement("menuitem");
|
||||||
|
menuitem.setAttribute("label", Zotero.getString("tabs.moveToStart"));
|
||||||
|
menuitem.setAttribute("disabled", tabIndex == 1 ? "true" : "false");
|
||||||
|
menuitem.addEventListener("command", () => {
|
||||||
|
Zotero_Tabs.move(id, 1);
|
||||||
|
});
|
||||||
|
menupopup.appendChild(menuitem);
|
||||||
|
// Move to end
|
||||||
|
menuitem = doc.createXULElement("menuitem");
|
||||||
|
menuitem.setAttribute("label", Zotero.getString("tabs.moveToEnd"));
|
||||||
|
menuitem.setAttribute(
|
||||||
|
"disabled",
|
||||||
|
tabIndex == Zotero_Tabs._tabs.length - 1 ? "true" : "false",
|
||||||
|
);
|
||||||
|
menuitem.addEventListener("command", () => {
|
||||||
|
Zotero_Tabs.move(id, Zotero_Tabs._tabs.length);
|
||||||
|
});
|
||||||
|
menupopup.appendChild(menuitem);
|
||||||
|
// Move to new window
|
||||||
|
menuitem = doc.createXULElement("menuitem");
|
||||||
|
menuitem.setAttribute("label", Zotero.getString("tabs.moveToWindow"));
|
||||||
|
menuitem.setAttribute("disabled", "false");
|
||||||
|
menuitem.addEventListener("command", () => {
|
||||||
|
const { tab } = Zotero_Tabs._getTab(id);
|
||||||
|
Zotero_Tabs.close(id);
|
||||||
|
const { itemID } = tab.data;
|
||||||
|
addon.hooks.onOpenNote(itemID, "window", { forceTakeover: true });
|
||||||
|
});
|
||||||
|
menupopup.appendChild(menuitem);
|
||||||
|
// Duplicate tab
|
||||||
|
// menuitem = doc.createXULElement("menuitem");
|
||||||
|
// menuitem.setAttribute("label", Zotero.getString("tabs.duplicate"));
|
||||||
|
// menuitem.addEventListener("command", () => {
|
||||||
|
// if (tab.data.itemID) {
|
||||||
|
// const { secondViewState } = tab.data;
|
||||||
|
// Zotero.Reader.open(tab.data.itemID, null, {
|
||||||
|
// tabIndex: tabIndex + 1,
|
||||||
|
// allowDuplicate: true,
|
||||||
|
// secondViewState,
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// popup.appendChild(menuitem);
|
||||||
|
// Separator
|
||||||
|
popup.appendChild(doc.createXULElement("menuseparator"));
|
||||||
|
}
|
||||||
|
// Close
|
||||||
|
if (id != "zotero-pane") {
|
||||||
|
menuitem = doc.createXULElement("menuitem");
|
||||||
|
menuitem.setAttribute("label", Zotero.getString("general.close"));
|
||||||
|
menuitem.addEventListener("command", () => {
|
||||||
|
Zotero_Tabs.close(id);
|
||||||
|
});
|
||||||
|
popup.appendChild(menuitem);
|
||||||
|
}
|
||||||
|
// Close other tabs
|
||||||
|
if (!(Zotero_Tabs._tabs.length == 2 && id != "zotero-pane")) {
|
||||||
|
menuitem = doc.createXULElement("menuitem");
|
||||||
|
menuitem.setAttribute("label", Zotero.getString("tabs.closeOther"));
|
||||||
|
menuitem.addEventListener("command", () => {
|
||||||
|
Zotero_Tabs.close(
|
||||||
|
Zotero_Tabs._tabs
|
||||||
|
.slice(1)
|
||||||
|
.filter((x) => x.id != id)
|
||||||
|
.map((x) => x.id),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
popup.appendChild(menuitem);
|
||||||
|
}
|
||||||
|
// Undo close
|
||||||
|
menuitem = doc.createXULElement("menuitem");
|
||||||
|
menuitem.setAttribute(
|
||||||
|
"label",
|
||||||
|
Zotero.getString(
|
||||||
|
"tabs.undoClose",
|
||||||
|
[],
|
||||||
|
// If not disabled, show proper plural for tabs to reopen
|
||||||
|
// @ts-ignore
|
||||||
|
Zotero_Tabs._history.length
|
||||||
|
? // @ts-ignore
|
||||||
|
Zotero_Tabs._history[Zotero_Tabs._history.length - 1].length
|
||||||
|
: 1,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
menuitem.setAttribute(
|
||||||
|
"disabled",
|
||||||
|
// @ts-ignore
|
||||||
|
!Zotero_Tabs._history.length ? "true" : "false",
|
||||||
|
);
|
||||||
|
menuitem.addEventListener("command", () => {
|
||||||
|
Zotero_Tabs.undoClose();
|
||||||
|
});
|
||||||
|
popup.appendChild(menuitem);
|
||||||
|
popup.openPopupAtScreen(x, y, true);
|
||||||
|
}
|
||||||
|
|
@ -30,6 +30,7 @@ export function openNotePreview(
|
||||||
l10nID: `${config.addonRef}-note-preview-open`,
|
l10nID: `${config.addonRef}-note-preview-open`,
|
||||||
onClick: ({ event }) => {
|
onClick: ({ event }) => {
|
||||||
const position = (event as MouseEvent).shiftKey ? "window" : "tab";
|
const position = (event as MouseEvent).shiftKey ? "window" : "tab";
|
||||||
|
// @ts-ignore - plugin instance
|
||||||
Zotero[config.addonRef].hooks.onOpenNote(noteItem.id, position);
|
Zotero[config.addonRef].hooks.onOpenNote(noteItem.id, position);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -60,13 +60,13 @@ export function onTabSelect(tabType: string) {
|
||||||
ZoteroContextPane.update();
|
ZoteroContextPane.update();
|
||||||
}
|
}
|
||||||
|
|
||||||
export function restoreNoteTabs() {
|
export async function restoreNoteTabs() {
|
||||||
const tabsCache: _ZoteroTypes.TabInstance[] =
|
const tabsCache: _ZoteroTypes.TabInstance[] =
|
||||||
Zotero.Session.state.windows.find((x: any) => x.type == "pane")?.tabs;
|
Zotero.Session.state.windows.find((x: any) => x.type == "pane")?.tabs;
|
||||||
for (const i in tabsCache) {
|
for (const i in tabsCache) {
|
||||||
const tab = tabsCache[i];
|
const tab = tabsCache[i];
|
||||||
if (tab.type !== TAB_TYPE) continue;
|
if (tab.type !== TAB_TYPE) continue;
|
||||||
openWorkspaceTab(Zotero.Items.get(tab.data.itemID), {
|
openWorkspaceTab(await Zotero.Items.getAsync(tab.data.itemID), {
|
||||||
select: !!tab.selected,
|
select: !!tab.selected,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,11 @@ export function getNoteLinkParams(link: string) {
|
||||||
if (id === "u") {
|
if (id === "u") {
|
||||||
libraryID = Zotero.Libraries.userLibraryID;
|
libraryID = Zotero.Libraries.userLibraryID;
|
||||||
} else {
|
} else {
|
||||||
libraryID = Zotero.Groups.getLibraryIDFromGroupID(id);
|
const libID = Zotero.Groups.getLibraryIDFromGroupID(Number(id));
|
||||||
|
if (!libID) {
|
||||||
|
throw new Error("Invalid group ID");
|
||||||
|
}
|
||||||
|
libraryID = libID;
|
||||||
}
|
}
|
||||||
const line = url.searchParams.get("line");
|
const line = url.searchParams.get("line");
|
||||||
return {
|
return {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue