diff --git a/addon/locale/en-US/chartero-preferences.ftl b/addon/locale/en-US/chartero-preferences.ftl index 0a9f480..d6d8a12 100644 --- a/addon/locale/en-US/chartero-preferences.ftl +++ b/addon/locale/en-US/chartero-preferences.ftl @@ -24,4 +24,4 @@ compressHistory = Compress history data historySize = Current history size: { $size } KB maxSummaryItems = Do not render Summary when the number of items exceeds this value: lastAuthorSankey = Index of the last author in Sankey graph: -translate = Auto translate locale strings using PDFTranslate Plugin +translate = Auto translate locale strings using PDFTranslate Plugin (Experimental) diff --git a/addon/locale/zh-CN/chartero-preferences.ftl b/addon/locale/zh-CN/chartero-preferences.ftl index b8b972d..c69345e 100644 --- a/addon/locale/zh-CN/chartero-preferences.ftl +++ b/addon/locale/zh-CN/chartero-preferences.ftl @@ -24,4 +24,4 @@ compressHistory = 清理记录数据 historySize = 当前历史记录共占用存储空间:{ $size } KB maxSummaryItems = 条目数量超过多少时不再渲染侧边栏: lastAuthorSankey = 作者关系图中通讯作者名次: -translate = 调用PDFTranslate插件自动翻译界面语言 +translate = 调用PDFTranslate插件自动翻译界面语言(Beta) diff --git a/package.json b/package.json index 9d2212c..103bf1a 100644 --- a/package.json +++ b/package.json @@ -57,7 +57,7 @@ "highcharts": "^11.2.0", "highcharts-vue": "^1.4.3", "segmentit": "^2.0.3", - "tdesign-vue-next": "^1.7.0", + "tdesign-vue-next": "^1.7.1", "zotero-plugin-toolkit": "^2.3.11" }, "devDependencies": { @@ -82,11 +82,11 @@ "replace-in-file": "^7.0.2", "tdesign-icons-vue-next": "^0.2.2", "ts-node": "^10.9.1", - "unplugin-auto-import": "^0.17.1", - "unplugin-vue-components": "^0.25.2", - "vite": "^5.0.4", - "vue": "^3.3.9", - "vue-tsc": "^1.8.24", + "unplugin-auto-import": "^0.17.2", + "unplugin-vue-components": "^0.26.0", + "vite": "^5.0.6", + "vue": "^3.3.10", + "vue-tsc": "^1.8.25", "zotero-types": "file:../zotero-types" }, "eslintConfig": { @@ -114,4 +114,4 @@ "publish": false } } -} +} \ No newline at end of file diff --git a/src/bootstrap/modules/debug.ts b/src/bootstrap/modules/debug.ts index d4d373c..0e6ec7d 100644 --- a/src/bootstrap/modules/debug.ts +++ b/src/bootstrap/modules/debug.ts @@ -30,4 +30,48 @@ export function addDebugMenu() { icon: `chrome://${config.addonName}/content/icons/icon@16px.png`, commandListener: () => addon.log((addon.history)._mainItems) }); + addon.menu.register('menuHelp', { + tag: 'menuitem', + label: 'open dev tools', + icon: `chrome://${config.addonName}/content/icons/icon@16px.png`, + commandListener: () => { + const env = + Services.env || + Cc["@mozilla.org/process/environment;1"].getService(Ci.nsIEnvironment); + + env.set("MOZ_BROWSER_TOOLBOX_PORT", 6100); + Zotero.openInViewer( + "chrome://devtools/content/framework/browser-toolbox/window.html", + { + onLoad: (doc: Document) => { + doc.getElementById("status-message-container")!.style.visibility = "collapse"; + let toolboxBody: HTMLElement; + waitUntil( + () => { + toolboxBody = doc + .querySelector(".devtools-toolbox-browsertoolbox-iframe") + ?.contentDocument?.querySelector(".theme-body"); + return toolboxBody; + }, + () => { + toolboxBody.style = "pointer-events: all !important"; + } + ); + }, + } + ); + + function waitUntil(condition: () => unknown, callback: Function, interval = 100, timeout = 10000) { + const start = Date.now(); + const intervalId = setInterval(() => { + if (condition()) { + clearInterval(intervalId); + callback(); + } else if (Date.now() - start > timeout) { + clearInterval(intervalId); + } + }, interval); + } + } + }); } diff --git a/src/vue/summary/components/sankey.vue b/src/vue/summary/components/sankey.vue index caea97b..4b68cad 100644 --- a/src/vue/summary/components/sankey.vue +++ b/src/vue/summary/components/sankey.vue @@ -163,8 +163,12 @@ export default { nodes.push({ id: journal, column: 2, color }); } const maxRows = Math.max( - ...[0, 1, 2].map(col => nodes.filter(n => n.column === col).length) + journalSet.size, + firstCreatorSet.size, + lastCreatorSet.size + // ...[0, 1, 2].map(col => nodes.filter(n => n.column === col).length) ); + addon.log(nodes) return { chart: { animation: undefined, height: maxRows * 26 + 50 }, exporting: { menuItemDefinitions: helpMessageOption(this.locale.doc.sankey) },