Skip to content

Commit

Permalink
准备整理面板
Browse files Browse the repository at this point in the history
  • Loading branch information
zzlb0224 committed Mar 21, 2024
1 parent 8776b7a commit 30578b2
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 48 deletions.
14 changes: 7 additions & 7 deletions src/modules/annotations.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import { TagElementProps } from "zotero-plugin-toolkit/dist/tools/ui";
import { config } from "../../package.json";
import { getPref } from "../utils/prefs";
import {
sortByFixedTag2Length,
groupBy,
groupByResult,
memFixedTags,
uniqueBy,
groupByResultIncludeFixedTags,
memAllTagsDB,
memFixedColor,
memFixedTags,
memRelateTags,
sortByFixedTag2Length,
sortByLength,
str2RegExp,
uniqueBy,
} from "../utils/zzlb";
import { getPref } from "../utils/prefs";
import { groupByResultIncludeFixedTags } from "../utils/zzlb";
import { memAllTagsDB } from "../utils/zzlb";
import { memRelateTags } from "../utils/zzlb";
function register() {
// if (!getPref("enable")) return;
// ztoolkit.UI.basicOptions.log.disableZLog = true;
Expand Down
75 changes: 34 additions & 41 deletions src/modules/annotationsToNote.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
import { config } from "../../package.json";
import { ProgressWindowHelper } from "zotero-plugin-toolkit/dist/helpers/progressWindow";
import { MenuitemOptions } from "zotero-plugin-toolkit/dist/managers/menu";
import { TagElementProps } from "zotero-plugin-toolkit/dist/tools/ui";
import { config } from "../../package.json";
import {
groupBy,
uniqueBy,
promiseAllWithProgress,
sortByFixedTag2Length,
getChildCollections,
groupBy,
memFixedColor,
promiseAllWithProgress,
setProperty,
memAllTagsDB,
sortByFixedTag2Length,
str2RegExp,
toggleProperty,
uniqueBy,
} from "../utils/zzlb";
import { TagElementProps } from "zotero-plugin-toolkit/dist/tools/ui";
import { toggleProperty } from "../utils/zzlb";
import { str2RegExp } from "../utils/zzlb";
let popupWin: ProgressWindowHelper | undefined = undefined;
let popupTime = -1;

Expand Down Expand Up @@ -391,39 +390,9 @@ async function createChooseTagsDiv(doc: Document, isCollection: boolean) {
},
],
};
const children = [tagsDiv, actionDiv];

const div = ztoolkit.UI.appendElement(
{
tag: "div",
styles: {
padding: "20px",
position: "fixed",
left: "100px",
top: "100px",
zIndex: "9999",
width: "calc(100% - 200px)",
maxHeight: "400px",
overflowY: "scroll",
display: "flex",
background: "#a99",
flexWrap: "wrap",
flexDirection: "column",
},
children: [tagsDiv, actionDiv],
listeners: [
{
type: "click",
listener: (ev) => {
ev.stopPropagation();
const target = ev.target as HTMLElement;
// target.remove();
return false;
},
},
],
},
doc.querySelector("body,div")!,
);
const div = createTopDiv(children, doc);
createTags();
return div;

Expand Down Expand Up @@ -467,6 +436,30 @@ async function createChooseTagsDiv(doc: Document, isCollection: boolean) {
}
}

function createTopDiv(children: TagElementProps[], doc: Document) {
return ztoolkit.UI.appendElement(
{
tag: "div",
styles: {
padding: "20px",
position: "fixed",
left: "100px",
top: "100px",
zIndex: "9999",
width: "calc(100% - 200px)",
maxHeight: "400px",
overflowY: "scroll",
display: "flex",
background: "#a99",
flexWrap: "wrap",
flexDirection: "column",
},
children: children,
},
doc.querySelector("body,div")!,
);
}

async function saveNote(targetNoteItem: Zotero.Item, txt: string) {
await Zotero.BetterNotes.api.note.insert(targetNoteItem, txt, -1);
// const editor= await Zotero.BetterNotes.api.editor.getEditorInstance(targetNoteItem.id)
Expand Down

0 comments on commit 30578b2

Please sign in to comment.