diff --git a/.github/renovate.json b/.github/renovate.json index e4a9c0b8..d3066737 100644 --- a/.github/renovate.json +++ b/.github/renovate.json @@ -10,23 +10,15 @@ "group:allNonMajor", "schedule:weekly" ], - "labels": [ - "dependencies" - ], + "labels": ["dependencies"], "packageRules": [ { - "matchPackageNames": [ - "zotero-plugin-toolkit", - "zotero-types", - "zotero-plugin-scaffold" - ], - "schedule": [ - "at any time" - ], + "matchPackageNames": ["zotero-plugin-toolkit", "zotero-types", "zotero-plugin-scaffold"], + "schedule": ["at any time"], "automerge": true } ], "git-submodules": { "enabled": true } -} \ No newline at end of file +} diff --git a/addon/chrome/content/annotation.css b/addon/chrome/content/annotation.css index 5dd90da9..b5c670e8 100644 --- a/addon/chrome/content/annotation.css +++ b/addon/chrome/content/annotation.css @@ -32,4 +32,4 @@ background-color: #ccc; box-shadow: 0px 0px 8px #9e0909; /* border: 2px solid green; */ -} \ No newline at end of file +} diff --git a/addon/chrome/content/zoteroPane.css b/addon/chrome/content/zoteroPane.css index 44281907..a2e05a4c 100644 --- a/addon/chrome/content/zoteroPane.css +++ b/addon/chrome/content/zoteroPane.css @@ -10,4 +10,4 @@ background-color: #ccc; box-shadow: 0px 0px 5px #d92c2c; /* border: 2px solid green; */ -} \ No newline at end of file +} diff --git a/src/component/PopupRoot.tsx b/src/component/PopupRoot.tsx index 02f20743..799068da 100644 --- a/src/component/PopupRoot.tsx +++ b/src/component/PopupRoot.tsx @@ -33,8 +33,8 @@ import { type } from "os"; import { config } from "process"; import TagPopup from "./TagPopup"; import { Config, ConfigTab, ConfigTabArray, ConfigTypeArray, SortType, SortTypeArray, loadDefaultConfig } from "./Config"; -import "./tagStyle.css" -import styles from "./tagStyle.css" +import "./tagStyle.css"; +import styles from "./tagStyle.css"; // console.log(styles.tagButton) export function PopupRoot({ @@ -56,7 +56,7 @@ export function PopupRoot({ root: HTMLDivElement; maxWidth: number; }) { - ztoolkit.log("css测试", styles.tagButton) + ztoolkit.log("css测试", styles.tagButton); const item = reader._item; const _annotationManager = reader._annotationManager; ztoolkit.log("params", params); @@ -227,8 +227,8 @@ export function PopupRoot({ lineHeight: lineHeight, cursor: "default", ":hover": { - marginTop: "20px" - } + marginTop: "20px", + }, }; const configItemStyle = { display: "inline-block", margin: "0 5px" }; function inputWidth(searchTag: string) { @@ -1082,7 +1082,7 @@ export function PopupRoot({ style={{ ...tagStyle, background: delTags.length > 0 ? "#990000" : "#009900", - color: "#fff" + color: "#fff", }} onClick={() => { setIsPopoverOpen(false); diff --git a/src/component/tagStyle.css b/src/component/tagStyle.css index 1373e18e..e966281d 100644 --- a/src/component/tagStyle.css +++ b/src/component/tagStyle.css @@ -1,8 +1,8 @@ .tagButton { - cursor: pointer; + cursor: pointer; } .tagButton:hover { - background-color: #ccc; - box-shadow: 0px 0px 5px #fff; -} \ No newline at end of file + background-color: #ccc; + box-shadow: 0px 0px 5px #fff; +} diff --git a/src/component/tagStyle.d.ts b/src/component/tagStyle.d.ts index 791fee6c..9d233817 100644 --- a/src/component/tagStyle.d.ts +++ b/src/component/tagStyle.d.ts @@ -1,4 +1,4 @@ -declare module '*.css' { - const styles: { [key: string]: string }; - export = styles; +declare module "*.css" { + const styles: { [key: string]: string }; + export = styles; } diff --git a/src/modules/AnnotationPopup.tsx b/src/modules/AnnotationPopup.tsx index bf3c7dc1..da773d13 100644 --- a/src/modules/AnnotationPopup.tsx +++ b/src/modules/AnnotationPopup.tsx @@ -122,7 +122,6 @@ export class AnnotationPopup { // win.document.head, // ); - // if (!this.doc.getElementById(`${config.addonRef}annotationCss`)) { // const styles = ztoolkit.UI.createElement(this.doc, "link", { @@ -136,27 +135,23 @@ export class AnnotationPopup { // this.doc.documentElement.appendChild(styles); // } - - this.rootDiv = ztoolkit.UI.createElement(this.doc, "div", { namespace: "html", id: this.idRootDiv, // styles: this.getRootStyle(), //创建的时候就要固定大小 // classList: ["width100", "minWidth100"], children: [ - { tag: "linkset", children: [ { tag: "style", properties: { - type: "text/css", innerHTML: ` - ` - } - } + `, + }, + }, // { // namespace: "html", // tag: "link", @@ -176,8 +171,8 @@ export class AnnotationPopup { // href: `chrome://${config.addonRef}/content/annotation.css`, // }, // }, - ] - } + ], + }, ], listeners: [ { diff --git a/src/modules/annotations.tsx b/src/modules/annotations.tsx index bbc882bf..71975554 100644 --- a/src/modules/annotations.tsx +++ b/src/modules/annotations.tsx @@ -27,7 +27,7 @@ function unregister() { function renderTextSelectionPopup(event: _ZoteroTypes.Reader.EventParams<"renderTextSelectionPopup">) { const { append, reader, doc, params } = event; - const filename = "annotation.css" + const filename = "annotation.css"; addCssFile(doc, filename, true); addCssFile(ZoteroPane.document, filename, true); addCssFile(reader?._window?.document, filename, true); diff --git a/src/modules/referenceMark.tsx b/src/modules/referenceMark.tsx index 7cb90577..6b2d7d53 100644 --- a/src/modules/referenceMark.tsx +++ b/src/modules/referenceMark.tsx @@ -13,10 +13,6 @@ export default { register, unregister }; function readerToolbarCallback(event: Parameters<_ZoteroTypes.Reader.EventHandler<"renderToolbar">>[0]) { const { append, doc, reader, params } = event; - - - - if (doc.getElementById(`${config.addonRef}-space-button`)) return; // setTimeout(() => { // const tabDiv = Zotero_Tabs.deck.querySelector("#" + Zotero_Tabs.selectedID) as HTMLDivElement diff --git a/src/utils/tab.ts b/src/utils/tab.ts index 1826b778..514d4885 100644 --- a/src/utils/tab.ts +++ b/src/utils/tab.ts @@ -23,12 +23,13 @@ export class Tab { constructor(url: string, title: string, onLoad?: (doc: Document) => void) { this.onLoad = onLoad; if (this.tab) { - const index = Zotero_Tabs._getTab(this.tab.id).tabIndex; - Zotero_Tabs._tabs[index]["title"] = "new Tab - " + title; - - this.browser.loadURI(url, { - triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal(), - }); + const index = Zotero_Tabs._getTab(this.tab.id)?.tabIndex; + if (index) { + Zotero_Tabs._tabs[index]["title"] = "new Tab - " + title; + this.browser.loadURI(url, { + triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal(), + }); + } } else { this.tab = Zotero_Tabs.add({ type: config.addonInstance, diff --git a/src/utils/zzlb.ts b/src/utils/zzlb.ts index a268d74c..9024658a 100644 --- a/src/utils/zzlb.ts +++ b/src/utils/zzlb.ts @@ -278,12 +278,12 @@ const memAllTagsInLibraryAsync = memoize(async () => { ); const itemTags = getPref("item-tags") ? items.flatMap((f) => - f.getTags().map((a) => ({ - tag: a.tag, - type: a.type, - dateModified: f.dateModified, - })), - ) + f.getTags().map((a) => ({ + tag: a.tag, + type: a.type, + dateModified: f.dateModified, + })), + ) : []; return groupBy([...tags, ...itemTags], (t14) => t14.tag); }); @@ -443,11 +443,11 @@ export async function injectCSS(doc: Document | HTMLDivElement, filename: string ignoreIfExists: true, }, doc.querySelector("linkset") || - doc.querySelector("head") || - doc.querySelector("body") || - doc.querySelector("div") || - doc.children[0] || - doc, + doc.querySelector("head") || + doc.querySelector("body") || + doc.querySelector("div") || + doc.children[0] || + doc, ); // ztoolkit.log("加载css", d); }