From 2d1e922876f0a2812479672140b02bee4c2537f1 Mon Sep 17 00:00:00 2001 From: MuiseDestiny <51939531+MuiseDestiny@users.noreply.github.com> Date: Wed, 1 Mar 2023 16:21:21 +0800 Subject: [PATCH] =?UTF-8?q?#184:=20Zotero.Reader.open=E5=B0=91=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E5=AF=BC=E8=87=B4=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- src/modules/tags.ts | 13 +++++++++---- src/modules/views.ts | 7 ++++--- update.json | 4 ++-- update.rdf | 2 +- 5 files changed, 17 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index ab53e56..24bd60a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "zotero-style", - "version": "2.3.1", + "version": "2.3.2", "description": "让你的Zotero看起来更有趣", "config": { "addonName": "Zotero Style", diff --git a/src/modules/tags.ts b/src/modules/tags.ts index 1c45936..2de6040 100644 --- a/src/modules/tags.ts +++ b/src/modules/tags.ts @@ -222,7 +222,7 @@ export class Tags { width: "calc(100% - 10px)", padding: "5px", height: "auto", - overflowX: "hidden", + overflowX: "", overflowY: "auto" } }, this.nestedTagsContainer) as HTMLDivElement; @@ -718,7 +718,7 @@ export class Tags { listener: () => { // 从obsidian源码找到的过度 const duration = 100 - const transition = `all ${duration}ms cubic-bezier(0.02, 0.01, 0.47, 1) 0s` + const transition = `height ${duration}ms cubic-bezier(0.02, 0.01, 0.47, 1) 0s` this.state[key].collapse = !this.state[key].collapse collapseNode!.style!.transform = this.state[key].collapse ? "rotate(-90deg)" : "" tree.style.overflow = "hidden"; @@ -726,9 +726,11 @@ export class Tags { if (this.state[key].collapse) { // 折叠 tree.style.height = window.getComputedStyle(tree).height; + // console.log("from", tree.style.height) + tree.style.transition = transition; window.setTimeout(() => { - tree.style.transition = transition; tree.style.height = "0px" + // console.log("to", tree.style.height) }) window.setTimeout(() => { tree.querySelectorAll("*").forEach(e => e.remove()) @@ -740,14 +742,17 @@ export class Tags { this.render(...args) const height = window.getComputedStyle(tree).height tree.style.height = "0px" + // console.log("from", tree.style.height) + tree.style.transition = transition; window.setTimeout(() => { - tree.style.transition = transition; tree.style.height = height + // console.log("to", tree.style.height) }) } window.setTimeout(() => { tree.style.height = "" tree.style.overflow = ""; + tree.style.transition = ""; }, duration) } } diff --git a/src/modules/views.ts b/src/modules/views.ts index f10b375..3d5ef77 100644 --- a/src/modules/views.ts +++ b/src/modules/views.ts @@ -3461,14 +3461,14 @@ export default class Views { }) }) - // await Zotero.OpenPDF.openToPage(ZoteroPane.getSelectedItems()[0], 2, "CJWKZXCB") // Zotero.Reader.open(item.id, location ztoolkit.patch( Zotero.Reader, "open", config.addonRef, (original) => - async (id: number, location: { pageIndex: number, annotationKey: string }) => { + async (id: number, location: { pageIndex: number, annotationKey: string }, ...other: any) => { + console.log("open", location, other) if (!location) { const tagStart = tagsUI.getTagStart() if (tagStart) { @@ -3485,6 +3485,7 @@ export default class Views { } } } + console.log("then", location) window.setTimeout(async () => { // 随着缩放它会一直闪烁,这个bug一直没修复 const win = ( @@ -3503,7 +3504,7 @@ export default class Views { }, }, win.document.documentElement as any); }, 0) - return original.call(Zotero.Reader, id, location) + return original.call(Zotero.Reader, id, location, ...other) } ) } diff --git a/update.json b/update.json index 83ae203..df8079c 100644 --- a/update.json +++ b/update.json @@ -3,7 +3,7 @@ "zoterostyle@polygon.org": { "updates": [ { - "version": "2.3.1", + "version": "2.3.2", "update_link": "https://github.com/muisedestiny/zotero-style/releases/latest/download/zotero-style.xpi", "applications": { "gecko": { @@ -12,7 +12,7 @@ } }, { - "version": "2.3.1", + "version": "2.3.2", "update_link": "https://github.com/muisedestiny/zotero-style/releases/latest/download/zotero-style.xpi", "applications": { "zotero": { diff --git a/update.rdf b/update.rdf index a5e35ef..af95f75 100644 --- a/update.rdf +++ b/update.rdf @@ -5,7 +5,7 @@ - 2.3.1 + 2.3.2 zotero@chnm.gmu.edu