Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
zzlb0224 committed Jul 10, 2024
1 parent a95739b commit 21805a5
Show file tree
Hide file tree
Showing 11 changed files with 43 additions and 59 deletions.
16 changes: 4 additions & 12 deletions .github/renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
}
2 changes: 1 addition & 1 deletion addon/chrome/content/annotation.css
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@
background-color: #ccc;
box-shadow: 0px 0px 8px #9e0909;
/* border: 2px solid green; */
}
}
2 changes: 1 addition & 1 deletion addon/chrome/content/zoteroPane.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
background-color: #ccc;
box-shadow: 0px 0px 5px #d92c2c;
/* border: 2px solid green; */
}
}
12 changes: 6 additions & 6 deletions src/component/PopupRoot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand All @@ -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);
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -1082,7 +1082,7 @@ export function PopupRoot({
style={{
...tagStyle,
background: delTags.length > 0 ? "#990000" : "#009900",
color: "#fff"
color: "#fff",
}}
onClick={() => {
setIsPopoverOpen(false);
Expand Down
8 changes: 4 additions & 4 deletions src/component/tagStyle.css
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
.tagButton {
cursor: pointer;
cursor: pointer;
}

.tagButton:hover {
background-color: #ccc;
box-shadow: 0px 0px 5px #fff;
}
background-color: #ccc;
box-shadow: 0px 0px 5px #fff;
}
6 changes: 3 additions & 3 deletions src/component/tagStyle.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
declare module '*.css' {
const styles: { [key: string]: string };
export = styles;
declare module "*.css" {
const styles: { [key: string]: string };
export = styles;
}
15 changes: 5 additions & 10 deletions src/modules/AnnotationPopup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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", {

Expand All @@ -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",
Expand All @@ -176,8 +171,8 @@ export class AnnotationPopup {
// href: `chrome://${config.addonRef}/content/annotation.css`,
// },
// },
]
}
],
},
],
listeners: [
{
Expand Down
2 changes: 1 addition & 1 deletion src/modules/annotations.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 0 additions & 4 deletions src/modules/referenceMark.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 7 additions & 6 deletions src/utils/tab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
22 changes: 11 additions & 11 deletions src/utils/zzlb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit 21805a5

Please sign in to comment.