dsh-plugin-zotero 0.9.2 → 0.9.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/client/client.js +934 -141
- package/lib/host/approval.d.ts +46 -0
- package/lib/host/approval.js +56 -0
- package/lib/host/mcp-bridge.js +40 -4
- package/lib/host/router.js +48 -13
- package/lib/host/write-tools.js +20 -2
- package/lib/zotero/client.d.ts +4 -0
- package/lib/zotero/client.js +61 -17
- package/lib/zotero/types.d.ts +13 -2
- package/package.json +1 -1
package/client/client.js
CHANGED
|
@@ -237,8 +237,12 @@ const dicts = {
|
|
|
237
237
|
"list.sortDesc": "标题倒序 Z→A(再点恢复原始顺序)",
|
|
238
238
|
"list.expandAttachments": "展开附件",
|
|
239
239
|
"list.collapseAttachments": "收起附件",
|
|
240
|
-
"list.
|
|
241
|
-
"list.
|
|
240
|
+
"list.childKind.pdf": "PDF",
|
|
241
|
+
"list.childKind.snapshot": "网页快照",
|
|
242
|
+
"list.childKind.webpage": "网页链接",
|
|
243
|
+
"list.childKind.note": "笔记",
|
|
244
|
+
"list.childKind.file": "附件",
|
|
245
|
+
"list.openAttachment": "打开附件 / 笔记",
|
|
242
246
|
"tags.title": "标签",
|
|
243
247
|
"tags.filterPlaceholder": "筛选标签名称",
|
|
244
248
|
"tags.empty": "这个文库还没有标签",
|
|
@@ -340,6 +344,80 @@ const dicts = {
|
|
|
340
344
|
"toast.insertedItems": "已把 {n} 条加入会话草稿",
|
|
341
345
|
"toast.copied": "已复制",
|
|
342
346
|
"toast.copyFailed": "复制失败",
|
|
347
|
+
"help.button": "使用帮助",
|
|
348
|
+
"help.buttonTitle": "查看插件使用教程",
|
|
349
|
+
"help.title": "Zotero 使用帮助",
|
|
350
|
+
"help.subtitle": "把文献带进对话,然后试试这些指令",
|
|
351
|
+
"help.pin": "钉住窗口",
|
|
352
|
+
"help.unpin": "取消钉住",
|
|
353
|
+
"help.close": "关闭",
|
|
354
|
+
"help.copy": "复制",
|
|
355
|
+
"help.resize": "拖动调整窗口大小",
|
|
356
|
+
"help.tab.start": "快速上手",
|
|
357
|
+
"help.tab.reading": "精读与理解",
|
|
358
|
+
"help.tab.notes": "笔记整理",
|
|
359
|
+
"help.tab.library": "文库管理",
|
|
360
|
+
"help.tab.shots": "截图与标注",
|
|
361
|
+
"help.start.title": "先把手头的内容加入对话",
|
|
362
|
+
"help.start.desc": "下面七种内容都能变成对话里的引用。点每条的「复制」,把指令粘到对话框,模型就能基于它工作。",
|
|
363
|
+
"help.start.footnote": "说明:文献全文不是单独的引用类型。要让模型读全文,先加入一条摘录定位条目,再说「结合全文回答……」即可(模型会自行读取正文)。",
|
|
364
|
+
"help.reading.title": "读文献、解名词、做对比",
|
|
365
|
+
"help.reading.desc": "加入条目或摘录后,直接下达阅读类指令。",
|
|
366
|
+
"help.notes.title": "把零散内容整理成笔记",
|
|
367
|
+
"help.notes.desc": "把多条摘录、标注、笔记一起加入对话,再让它归纳改写。",
|
|
368
|
+
"help.library.title": "整理分类、导入导出",
|
|
369
|
+
"help.library.desc": "让模型创建 Zotero 分类、加标签、按 DOI 入库、导出参考文献。需要开启写权限。",
|
|
370
|
+
"help.shots.title": "用截图和高亮提问",
|
|
371
|
+
"help.shots.desc": "截图会以图片随对话发送,高亮与划选会带上原文,可据此追问。",
|
|
372
|
+
"help.ex.start.1.label": "单条条目",
|
|
373
|
+
"help.ex.start.1.hint": "文档左上角「加入对话」,或条目行右键「添加条目引用」",
|
|
374
|
+
"help.ex.start.1.prompt": "上面这篇文献的摘要说了什么?用三句话概括。",
|
|
375
|
+
"help.ex.start.2.label": "划选摘录",
|
|
376
|
+
"help.ex.start.2.hint": "在全文里拖选文字 → 浮条「加入对话」",
|
|
377
|
+
"help.ex.start.2.prompt": "逐句解释我刚加入的这段摘录。",
|
|
378
|
+
"help.ex.start.3.label": "高亮标注",
|
|
379
|
+
"help.ex.start.3.hint": "信息浮层「标注」块,每行点「引用」",
|
|
380
|
+
"help.ex.start.3.prompt": "结合这条高亮的批注,说明作者在强调什么。",
|
|
381
|
+
"help.ex.start.4.label": "笔记",
|
|
382
|
+
"help.ex.start.4.hint": "信息浮层「笔记」块,每行点「加入对话」",
|
|
383
|
+
"help.ex.start.4.prompt": "把这条笔记补进我的文献综述,保持原有引用出处。",
|
|
384
|
+
"help.ex.start.5.label": "整个目录",
|
|
385
|
+
"help.ex.start.5.hint": "分类树里右键「添加整目录引用」",
|
|
386
|
+
"help.ex.start.5.prompt": "按年份从新到旧梳理这个目录里的条目,并指出研究主题分布。",
|
|
387
|
+
"help.ex.start.6.label": "划词翻译",
|
|
388
|
+
"help.ex.start.6.hint": "划选 → 浮条「翻译」→ 译文浮层「加入对话」",
|
|
389
|
+
"help.ex.start.6.prompt": "对照原文和译文,指出三处值得注意的术语翻译。",
|
|
390
|
+
"help.ex.start.7.label": "截图",
|
|
391
|
+
"help.ex.start.7.hint": "文档左上角「截图加入对话」→ 框选 →「加入对话」",
|
|
392
|
+
"help.ex.start.7.prompt": "把截图里的表格用文字复述出来。",
|
|
393
|
+
"help.ex.reading.1.label": "精读文献",
|
|
394
|
+
"help.ex.reading.1.prompt": "请精读上面这篇文献,按「研究问题 / 方法 / 主要结论 / 局限」四部分总结,并标出对应页码。",
|
|
395
|
+
"help.ex.reading.2.label": "解释名词",
|
|
396
|
+
"help.ex.reading.2.prompt": "解释上面文献里反复出现的专业名词,列成表格:术语|一句话解释|文中出处。",
|
|
397
|
+
"help.ex.reading.3.label": "逐句翻译",
|
|
398
|
+
"help.ex.reading.3.prompt": "把上面这段摘录逐句翻译为中文,保留术语原文并附在括号里。",
|
|
399
|
+
"help.ex.reading.4.label": "多篇对比",
|
|
400
|
+
"help.ex.reading.4.prompt": "对比上面三篇文献的研究方法和结论,做成一张表,并指出它们的分歧点。",
|
|
401
|
+
"help.ex.notes.1.label": "结构化笔记",
|
|
402
|
+
"help.ex.notes.1.prompt": "把上面这几段摘录和笔记整理成一份结构化中文笔记,按主题分节,每节给出要点和出处。",
|
|
403
|
+
"help.ex.notes.2.label": "提炼要点",
|
|
404
|
+
"help.ex.notes.2.prompt": "用 5 条要点总结上面这篇文献,每条不超过 30 字。",
|
|
405
|
+
"help.ex.notes.3.label": "改写摘录",
|
|
406
|
+
"help.ex.notes.3.prompt": "把上面的摘录改写成我自己的话,保持原意,专有名词请保留。",
|
|
407
|
+
"help.ex.library.1.label": "整理目录(建分类)",
|
|
408
|
+
"help.ex.library.1.prompt": "把上面这几篇文献放进 Zotero 的「机器学习/精读」分类;分类不存在就先创建。",
|
|
409
|
+
"help.ex.library.2.label": "导出参考文献",
|
|
410
|
+
"help.ex.library.2.prompt": "把当前 Zotero 分类的条目按 APA 格式整理成参考文献列表。",
|
|
411
|
+
"help.ex.library.3.label": "按 DOI 导入条目",
|
|
412
|
+
"help.ex.library.3.prompt": "根据 DOI 10.1038/nature14539 把这个条目导入我的 Zotero 文库,并加上标签「待读」。",
|
|
413
|
+
"help.ex.library.4.label": "批量加标签",
|
|
414
|
+
"help.ex.library.4.prompt": "给上面插入的这些条目统一加上标签「精读」,已有标签保留。",
|
|
415
|
+
"help.ex.shots.1.label": "截图提问",
|
|
416
|
+
"help.ex.shots.1.prompt": "根据上面这张截图里的公式,用文字复述每一步推导。",
|
|
417
|
+
"help.ex.shots.2.label": "引用标注",
|
|
418
|
+
"help.ex.shots.2.prompt": "引用我这条高亮里的批注,说明作者为什么这样设计实验。",
|
|
419
|
+
"help.ex.shots.3.label": "划选追问",
|
|
420
|
+
"help.ex.shots.3.prompt": "解释我刚划选的这句话在全文论证中的作用。",
|
|
343
421
|
"settings.nav": "Zotero文献库",
|
|
344
422
|
"settings.hint": "这些参数决定面板与模型工具如何连上 Zotero;改完自动保存、即时生效,无需重启。",
|
|
345
423
|
"group.api": "API 设置",
|
|
@@ -667,8 +745,12 @@ const dicts = {
|
|
|
667
745
|
"list.sortDesc": "Title Z→A (click again for default order)",
|
|
668
746
|
"list.expandAttachments": "Expand attachments",
|
|
669
747
|
"list.collapseAttachments": "Collapse attachments",
|
|
670
|
-
"list.
|
|
671
|
-
"list.
|
|
748
|
+
"list.childKind.pdf": "PDF",
|
|
749
|
+
"list.childKind.snapshot": "Web snapshot",
|
|
750
|
+
"list.childKind.webpage": "Web link",
|
|
751
|
+
"list.childKind.note": "Note",
|
|
752
|
+
"list.childKind.file": "File",
|
|
753
|
+
"list.openAttachment": "Open attachment or note",
|
|
672
754
|
"tags.title": "Tags",
|
|
673
755
|
"tags.filterPlaceholder": "Filter tag names",
|
|
674
756
|
"tags.empty": "This library has no tags yet",
|
|
@@ -770,6 +852,80 @@ const dicts = {
|
|
|
770
852
|
"toast.insertedItems": "Added {n} to the conversation draft",
|
|
771
853
|
"toast.copied": "Copied",
|
|
772
854
|
"toast.copyFailed": "Copy failed",
|
|
855
|
+
"help.button": "How to Use",
|
|
856
|
+
"help.buttonTitle": "View the plugin tutorial",
|
|
857
|
+
"help.title": "Zotero Help",
|
|
858
|
+
"help.subtitle": "Bring literature into the chat, then try these prompts",
|
|
859
|
+
"help.pin": "Pin window",
|
|
860
|
+
"help.unpin": "Unpin window",
|
|
861
|
+
"help.close": "Close",
|
|
862
|
+
"help.copy": "Copy",
|
|
863
|
+
"help.resize": "Drag to resize the window",
|
|
864
|
+
"help.tab.start": "Quick Start",
|
|
865
|
+
"help.tab.reading": "Read & Understand",
|
|
866
|
+
"help.tab.notes": "Notes",
|
|
867
|
+
"help.tab.library": "Library",
|
|
868
|
+
"help.tab.shots": "Screenshots & Annotations",
|
|
869
|
+
"help.start.title": "First, add something to the conversation",
|
|
870
|
+
"help.start.desc": "All seven kinds of content below become references in the chat. Hit \"Copy\" on any item, paste the prompt into the chat box, and the model will work on it.",
|
|
871
|
+
"help.start.footnote": "Note: full text is not a separate reference type. To have the model read it, first add an excerpt to locate the item, then say \"answer based on the full text…\" (the model reads the body itself).",
|
|
872
|
+
"help.reading.title": "Read papers, explain terms, compare",
|
|
873
|
+
"help.reading.desc": "Once an item or excerpt is added, just give reading instructions.",
|
|
874
|
+
"help.notes.title": "Turn scattered bits into notes",
|
|
875
|
+
"help.notes.desc": "Add several excerpts, annotations and notes together, then ask it to summarize or rewrite.",
|
|
876
|
+
"help.library.title": "Organize, import & export",
|
|
877
|
+
"help.library.desc": "Ask the model to create collections, add tags, import by DOI, or export references. Write permission is required.",
|
|
878
|
+
"help.shots.title": "Ask with screenshots & highlights",
|
|
879
|
+
"help.shots.desc": "Screenshots are sent as images and highlights carry their source text, so you can ask follow-up questions.",
|
|
880
|
+
"help.ex.start.1.label": "Single item",
|
|
881
|
+
"help.ex.start.1.hint": "\"Add to chat\" at the top-left of the document, or right-click an item row",
|
|
882
|
+
"help.ex.start.1.prompt": "What does the abstract of the paper above say? Summarize it in three sentences.",
|
|
883
|
+
"help.ex.start.2.label": "Text excerpt",
|
|
884
|
+
"help.ex.start.2.hint": "Select text in the document, then \"Add to chat\" on the floating bar",
|
|
885
|
+
"help.ex.start.2.prompt": "Explain the excerpt I just added, sentence by sentence.",
|
|
886
|
+
"help.ex.start.3.label": "Highlight annotation",
|
|
887
|
+
"help.ex.start.3.hint": "In the info panel \"Annotations\" block, click \"Cite\" on a row",
|
|
888
|
+
"help.ex.start.3.prompt": "Using the note on this highlight, explain what the author is emphasizing.",
|
|
889
|
+
"help.ex.start.4.label": "Note",
|
|
890
|
+
"help.ex.start.4.hint": "In the info panel \"Notes\" block, click \"Add to chat\" on a row",
|
|
891
|
+
"help.ex.start.4.prompt": "Add this note into my literature review, keeping the original citations.",
|
|
892
|
+
"help.ex.start.5.label": "Whole collection",
|
|
893
|
+
"help.ex.start.5.hint": "Right-click a collection in the tree, \"Add whole collection\"",
|
|
894
|
+
"help.ex.start.5.prompt": "List the items in this collection from newest to oldest and map out the research themes.",
|
|
895
|
+
"help.ex.start.6.label": "Translation",
|
|
896
|
+
"help.ex.start.6.hint": "Select text → \"Translate\" on the floating bar → \"Add to chat\" in the popup",
|
|
897
|
+
"help.ex.start.6.prompt": "Compare the original and the translation, and point out three noteworthy term choices.",
|
|
898
|
+
"help.ex.start.7.label": "Screenshot",
|
|
899
|
+
"help.ex.start.7.hint": "\"Screenshot to chat\" at the top-left of the document → select an area → \"Add to chat\"",
|
|
900
|
+
"help.ex.start.7.prompt": "Restate the table in the screenshot above as text.",
|
|
901
|
+
"help.ex.reading.1.label": "Close reading",
|
|
902
|
+
"help.ex.reading.1.prompt": "Closely read the paper above and summarize it in four parts: research question / method / key findings / limitations, with page numbers.",
|
|
903
|
+
"help.ex.reading.2.label": "Explain terms",
|
|
904
|
+
"help.ex.reading.2.prompt": "Explain the recurring technical terms in the paper above as a table: term | one-line explanation | where it appears.",
|
|
905
|
+
"help.ex.reading.3.label": "Sentence-by-sentence translation",
|
|
906
|
+
"help.ex.reading.3.prompt": "Translate the excerpt above into English sentence by sentence, keeping technical terms in parentheses.",
|
|
907
|
+
"help.ex.reading.4.label": "Compare papers",
|
|
908
|
+
"help.ex.reading.4.prompt": "Compare the methods and findings of the three papers above in a table and point out where they disagree.",
|
|
909
|
+
"help.ex.notes.1.label": "Structured notes",
|
|
910
|
+
"help.ex.notes.1.prompt": "Turn the excerpts and notes above into structured notes in Chinese, grouped by topic with key points and sources for each section.",
|
|
911
|
+
"help.ex.notes.2.label": "Key takeaways",
|
|
912
|
+
"help.ex.notes.2.prompt": "Summarize the paper above in 5 bullet points, no more than 30 words each.",
|
|
913
|
+
"help.ex.notes.3.label": "Rephrase excerpt",
|
|
914
|
+
"help.ex.notes.3.prompt": "Rewrite the excerpt above in my own words, keeping the meaning; keep proper nouns as they are.",
|
|
915
|
+
"help.ex.library.1.label": "Organize (create collection)",
|
|
916
|
+
"help.ex.library.1.prompt": "Put the papers above into the Zotero \"Machine Learning / Reading\" collection; create it first if it does not exist.",
|
|
917
|
+
"help.ex.library.2.label": "Export references",
|
|
918
|
+
"help.ex.library.2.prompt": "Format the items in the current Zotero collection as an APA reference list.",
|
|
919
|
+
"help.ex.library.3.label": "Import by DOI",
|
|
920
|
+
"help.ex.library.3.prompt": "Import the item with DOI 10.1038/nature14539 into my Zotero library and tag it \"to read\".",
|
|
921
|
+
"help.ex.library.4.label": "Bulk tagging",
|
|
922
|
+
"help.ex.library.4.prompt": "Add the tag \"close-read\" to all the items above, keeping existing tags.",
|
|
923
|
+
"help.ex.shots.1.label": "Ask about a screenshot",
|
|
924
|
+
"help.ex.shots.1.prompt": "Based on the formula in the screenshot above, restate each derivation step in words.",
|
|
925
|
+
"help.ex.shots.2.label": "Cite an annotation",
|
|
926
|
+
"help.ex.shots.2.prompt": "Quote the note on my highlight above and explain why the author designed the experiment that way.",
|
|
927
|
+
"help.ex.shots.3.label": "Follow up on a selection",
|
|
928
|
+
"help.ex.shots.3.prompt": "Explain the role of the sentence I just selected in the overall argument of the paper.",
|
|
773
929
|
"settings.nav": "Zotero Library",
|
|
774
930
|
"settings.hint": "These parameters decide how the panel and the model tools reach Zotero; edits save automatically and take effect immediately, no restart needed.",
|
|
775
931
|
"group.api": "API settings",
|
|
@@ -1129,7 +1285,6 @@ function fetchAttachmentInfo(key, signal) {
|
|
|
1129
1285
|
function snapshotUrl(key) {
|
|
1130
1286
|
return `/dsh-zotero/snapshot/${encodeURIComponent(key)}/`;
|
|
1131
1287
|
}
|
|
1132
|
-
/** 用系统 Zotero 打开条目或附件页。 */
|
|
1133
1288
|
async function openInZotero(input) {
|
|
1134
1289
|
await post("open-in-zotero", input);
|
|
1135
1290
|
}
|
|
@@ -2238,6 +2393,15 @@ const KNOWN_SCOPES = [
|
|
|
2238
2393
|
"trash",
|
|
2239
2394
|
"recent"
|
|
2240
2395
|
];
|
|
2396
|
+
const VIRTUAL_COUNT_SCOPES = [
|
|
2397
|
+
"publications",
|
|
2398
|
+
"unfiled",
|
|
2399
|
+
"trash"
|
|
2400
|
+
];
|
|
2401
|
+
/** scope 是否是树里要显示数量的特殊目录。 */
|
|
2402
|
+
function isVirtualCountScope(scope) {
|
|
2403
|
+
return scope === "publications" || scope === "unfiled" || scope === "trash";
|
|
2404
|
+
}
|
|
2241
2405
|
/** 文库根节点的 id(只存在于客户端,不对应任何 Zotero 分类)。 */
|
|
2242
2406
|
const TREE_ROOT_ID = "__library__";
|
|
2243
2407
|
/**
|
|
@@ -2331,6 +2495,7 @@ function initialState() {
|
|
|
2331
2495
|
expanded: /* @__PURE__ */ new Set([TREE_ROOT_ID, ...saved.expanded]),
|
|
2332
2496
|
treeQuery: "",
|
|
2333
2497
|
recentCount: 0,
|
|
2498
|
+
virtualCounts: {},
|
|
2334
2499
|
selectedCollection: saved.selected === null ? null : {
|
|
2335
2500
|
key: saved.selected.key,
|
|
2336
2501
|
name: saved.selected.name,
|
|
@@ -2355,12 +2520,14 @@ function initialState() {
|
|
|
2355
2520
|
toast: null
|
|
2356
2521
|
};
|
|
2357
2522
|
}
|
|
2358
|
-
function errorMessage$
|
|
2523
|
+
function errorMessage$5(error) {
|
|
2359
2524
|
return error instanceof Error ? error.message : String(error);
|
|
2360
2525
|
}
|
|
2361
2526
|
let state = initialState();
|
|
2362
2527
|
const listeners$1 = /* @__PURE__ */ new Set();
|
|
2363
2528
|
let treeInflight = null;
|
|
2529
|
+
/** 特殊目录计数的请求序号:刷新后迟到的旧结果不能覆盖新数量。 */
|
|
2530
|
+
let virtualCountsSeq = 0;
|
|
2364
2531
|
let tagsInflight = null;
|
|
2365
2532
|
let searchTimer = null;
|
|
2366
2533
|
let toastTimer = null;
|
|
@@ -2419,6 +2586,25 @@ function selectionQuery() {
|
|
|
2419
2586
|
return { collectionKey: collection.key };
|
|
2420
2587
|
}
|
|
2421
2588
|
/**
|
|
2589
|
+
* 后台补「我的出版物 / 未分类条目 / 回收站」的数量。
|
|
2590
|
+
*
|
|
2591
|
+
* 复用条目列表接口,只取一条读总数;不阻塞分类树渲染。单项失败保留上一次
|
|
2592
|
+
* 成功的值(如果还没有则继续不显示),刷新时靠序号丢掉迟到的旧结果。
|
|
2593
|
+
*/
|
|
2594
|
+
function loadVirtualCounts() {
|
|
2595
|
+
const seq = ++virtualCountsSeq;
|
|
2596
|
+
for (const scope of VIRTUAL_COUNT_SCOPES) fetchItems({
|
|
2597
|
+
scope,
|
|
2598
|
+
limit: 1
|
|
2599
|
+
}).then((data) => {
|
|
2600
|
+
if (seq !== virtualCountsSeq) return;
|
|
2601
|
+
patch({ virtualCounts: {
|
|
2602
|
+
...state.virtualCounts,
|
|
2603
|
+
[scope]: data.total
|
|
2604
|
+
} });
|
|
2605
|
+
}).catch(() => {});
|
|
2606
|
+
}
|
|
2607
|
+
/**
|
|
2422
2608
|
* 拉取状态与分类树。
|
|
2423
2609
|
*
|
|
2424
2610
|
* 成功后按 key 保留原选择(真实分类被删则回到文库根),再重拉条目列表;
|
|
@@ -2454,11 +2640,12 @@ function loadTree(force = false) {
|
|
|
2454
2640
|
expanded,
|
|
2455
2641
|
selectedCollection: selected
|
|
2456
2642
|
});
|
|
2643
|
+
loadVirtualCounts();
|
|
2457
2644
|
saveTreeState();
|
|
2458
2645
|
reloadItems({ reset: true });
|
|
2459
2646
|
loadTagUsage();
|
|
2460
2647
|
} catch (error) {
|
|
2461
|
-
patch({ treeError: errorMessage$
|
|
2648
|
+
patch({ treeError: errorMessage$5(error) });
|
|
2462
2649
|
} finally {
|
|
2463
2650
|
patch({ treeLoading: false });
|
|
2464
2651
|
treeInflight = null;
|
|
@@ -2534,7 +2721,7 @@ function loadTags(force = false) {
|
|
|
2534
2721
|
tagsError: null
|
|
2535
2722
|
});
|
|
2536
2723
|
} catch (error) {
|
|
2537
|
-
patch({ tagsError: errorMessage$
|
|
2724
|
+
patch({ tagsError: errorMessage$5(error) });
|
|
2538
2725
|
} finally {
|
|
2539
2726
|
patch({ tagsLoading: false });
|
|
2540
2727
|
tagsInflight = null;
|
|
@@ -2594,9 +2781,12 @@ function reloadItems(options) {
|
|
|
2594
2781
|
patch({ itemsLoading: true });
|
|
2595
2782
|
const recent = isRecentSelection(state.selectedCollection);
|
|
2596
2783
|
const tags = recent ? [] : [...state.selectedTags];
|
|
2784
|
+
const query = state.query.trim();
|
|
2785
|
+
const selectedScope = state.selectedCollection?.scope;
|
|
2786
|
+
const countScope = !append && query === "" && tags.length === 0 && isVirtualCountScope(selectedScope) ? selectedScope : null;
|
|
2597
2787
|
fetchItems({
|
|
2598
2788
|
...selectionQuery(),
|
|
2599
|
-
q:
|
|
2789
|
+
q: query,
|
|
2600
2790
|
tags: tags.length === 0 ? void 0 : tags,
|
|
2601
2791
|
tagMode: tags.length === 0 ? void 0 : state.tagMode,
|
|
2602
2792
|
sort: recent || state.sort === "none" ? void 0 : "title",
|
|
@@ -2605,14 +2795,17 @@ function reloadItems(options) {
|
|
|
2605
2795
|
offset
|
|
2606
2796
|
}, controller.signal).then((data) => {
|
|
2607
2797
|
if (current !== itemsSeq) return;
|
|
2798
|
+
const virtualCounts = { ...state.virtualCounts };
|
|
2799
|
+
if (countScope !== null) virtualCounts[countScope] = data.total;
|
|
2608
2800
|
patch({
|
|
2609
2801
|
items: append ? [...state.items, ...data.items] : data.items,
|
|
2610
2802
|
itemsTotal: data.total,
|
|
2611
|
-
itemsError: null
|
|
2803
|
+
itemsError: null,
|
|
2804
|
+
virtualCounts
|
|
2612
2805
|
});
|
|
2613
2806
|
}).catch((error) => {
|
|
2614
2807
|
if (current !== itemsSeq || controller.signal.aborted) return;
|
|
2615
|
-
patch({ itemsError: errorMessage$
|
|
2808
|
+
patch({ itemsError: errorMessage$5(error) });
|
|
2616
2809
|
}).finally(() => {
|
|
2617
2810
|
if (current !== itemsSeq) return;
|
|
2618
2811
|
patch({ itemsLoading: false });
|
|
@@ -2780,6 +2973,23 @@ const SOFT_BUTTON_ACTIVE_STYLE = {
|
|
|
2780
2973
|
};
|
|
2781
2974
|
/** 所有「浅底 + 描边」按钮共用的 class(primary 实心主操作不加)。 */
|
|
2782
2975
|
const SOFT_BUTTON_CLASS = "dsh-zp-soft-btn";
|
|
2976
|
+
/**
|
|
2977
|
+
* 「使用帮助」按钮:实心蓝底 + 白字,刻意比旁边的浅底描边按钮醒目。
|
|
2978
|
+
*
|
|
2979
|
+
* 蓝底是固定的品牌色、白字压在上面深浅主题都够对比,不需要 light-dark()。
|
|
2980
|
+
* hover / active 的加深写在 {@link THEME_CSS}(内联 style 写不了伪类)。
|
|
2981
|
+
*/
|
|
2982
|
+
const HELP_PRIMARY_STYLE = {
|
|
2983
|
+
color: "#ffffff",
|
|
2984
|
+
background: ACCENT,
|
|
2985
|
+
border: `1px solid ${ACCENT}`,
|
|
2986
|
+
boxShadow: "0 1px 3px rgba(31,64,128,0.28)",
|
|
2987
|
+
boxSizing: "border-box",
|
|
2988
|
+
fontWeight: 600,
|
|
2989
|
+
whiteSpace: "nowrap"
|
|
2990
|
+
};
|
|
2991
|
+
/** 帮助按钮的专属 class,供 THEME_CSS 写 hover / active(!important 盖住宿主 primary 默认态)。 */
|
|
2992
|
+
const HELP_BUTTON_CLASS = "dsh-zp-help-btn";
|
|
2783
2993
|
/** 标题外壳 class;文字色与渐变竖条写在 CSS 里(要做 light/dark 渐进增强)。 */
|
|
2784
2994
|
const SECTION_TITLE_CLASS = "dsh-zp-title";
|
|
2785
2995
|
/** 按钮 class:选中 / 激活态多挂 `is-active`,hover 时底色加深得更多。 */
|
|
@@ -2841,6 +3051,15 @@ function itemTypeIconClass(family, read = false) {
|
|
|
2841
3051
|
if (read) parts.push("is-read");
|
|
2842
3052
|
return parts.join(" ");
|
|
2843
3053
|
}
|
|
3054
|
+
/**
|
|
3055
|
+
* 子项(附件 / 笔记)图标的 class:复用条目图标的墨色与 light/dark 处理,
|
|
3056
|
+
* 只多三类特征色。`file` 不进配色表,落回默认墨色。
|
|
3057
|
+
*/
|
|
3058
|
+
function childKindIconClass(kind, read = false) {
|
|
3059
|
+
const parts = [ITEM_ICON_CLASS, `is-${kind}`];
|
|
3060
|
+
if (read) parts.push("is-read");
|
|
3061
|
+
return parts.join(" ");
|
|
3062
|
+
}
|
|
2844
3063
|
/** 全局主题样式:只在入口注入一次,portal / 浮层里的按钮同样生效。 */
|
|
2845
3064
|
const THEME_CSS = `
|
|
2846
3065
|
.dsh-zp-soft-btn {
|
|
@@ -2877,6 +3096,20 @@ const THEME_CSS = `
|
|
|
2877
3096
|
.dsh-zp-tag.is-selected:active {
|
|
2878
3097
|
background-color: #404040 !important;
|
|
2879
3098
|
}
|
|
3099
|
+
/* 帮助按钮:宿主 primary 默认色可能不是这支蓝,用 !important 钉住实心蓝底与 hover/active 加深。 */
|
|
3100
|
+
.dsh-zp-help-btn,
|
|
3101
|
+
.dsh-zp-help-btn:hover:not(:disabled),
|
|
3102
|
+
.dsh-zp-help-btn:active:not(:disabled) {
|
|
3103
|
+
color: #ffffff !important;
|
|
3104
|
+
}
|
|
3105
|
+
.dsh-zp-help-btn:hover:not(:disabled) {
|
|
3106
|
+
background-color: #3f7cf0 !important;
|
|
3107
|
+
border-color: #3f7cf0 !important;
|
|
3108
|
+
}
|
|
3109
|
+
.dsh-zp-help-btn:active:not(:disabled) {
|
|
3110
|
+
background-color: #3669d6 !important;
|
|
3111
|
+
border-color: #3669d6 !important;
|
|
3112
|
+
}
|
|
2880
3113
|
/* 条目类型图标:近黑墨色为主,只有书 / 笔记 / 附件留 Zotero 特征色。
|
|
2881
3114
|
先给宿主文字色兜底,再用 light-dark() 做深浅两套;老浏览器退成墨色。 */
|
|
2882
3115
|
.dsh-zp-item-icon {
|
|
@@ -2893,6 +3126,16 @@ const THEME_CSS = `
|
|
|
2893
3126
|
.dsh-zp-item-icon.is-attachment {
|
|
2894
3127
|
color: light-dark(#d32f3c, #f0727a);
|
|
2895
3128
|
}
|
|
3129
|
+
/* 列表子项:与条目图标共用描边与主题色,只给 PDF / 快照 / 网页 / 笔记分支。 */
|
|
3130
|
+
.dsh-zp-item-icon.is-pdf {
|
|
3131
|
+
color: light-dark(#d32f3c, #f0727a);
|
|
3132
|
+
}
|
|
3133
|
+
.dsh-zp-item-icon.is-snapshot {
|
|
3134
|
+
color: light-dark(#4072e5, #8eaef5);
|
|
3135
|
+
}
|
|
3136
|
+
.dsh-zp-item-icon.is-webpage {
|
|
3137
|
+
color: light-dark(#2f9e63, #6ec79a);
|
|
3138
|
+
}
|
|
2896
3139
|
.dsh-zp-item-icon.is-read {
|
|
2897
3140
|
opacity: 0.5;
|
|
2898
3141
|
filter: grayscale(1);
|
|
@@ -4241,7 +4484,7 @@ const EMPTY_DRAFT = {
|
|
|
4241
4484
|
pageLabel: "",
|
|
4242
4485
|
tags: ""
|
|
4243
4486
|
};
|
|
4244
|
-
function errorMessage$
|
|
4487
|
+
function errorMessage$4(error) {
|
|
4245
4488
|
return error instanceof Error ? error.message : String(error);
|
|
4246
4489
|
}
|
|
4247
4490
|
/**
|
|
@@ -4404,7 +4647,7 @@ function AnnotationList({ t, annotations, hasFulltext, truncated, filter, canWri
|
|
|
4404
4647
|
onChanged();
|
|
4405
4648
|
return true;
|
|
4406
4649
|
} catch (error) {
|
|
4407
|
-
setNotice(tpl(t("annotation.writeFailed"), { message: errorMessage$
|
|
4650
|
+
setNotice(tpl(t("annotation.writeFailed"), { message: errorMessage$4(error) }));
|
|
4408
4651
|
return false;
|
|
4409
4652
|
} finally {
|
|
4410
4653
|
setBusy(false);
|
|
@@ -5140,7 +5383,7 @@ function useFloatingBox(options) {
|
|
|
5140
5383
|
draggedRef.current = false;
|
|
5141
5384
|
setBlockedOutside(false);
|
|
5142
5385
|
blockedRef.current = false;
|
|
5143
|
-
const saved = readPanelBox(itemKey, kind);
|
|
5386
|
+
const saved = optsRef.current.persist === false ? null : readPanelBox(itemKey, kind);
|
|
5144
5387
|
const nextSize = saved?.size === void 0 ? null : clampSize$1(saved.size, 0, 0, optsRef.current);
|
|
5145
5388
|
setSize(nextSize);
|
|
5146
5389
|
const savedPos = lastProbeBlocked ? void 0 : saved?.pos;
|
|
@@ -5279,6 +5522,7 @@ function useFloatingBox(options) {
|
|
|
5279
5522
|
const node = panelRef.current;
|
|
5280
5523
|
if (node === null) return;
|
|
5281
5524
|
const rect = node.getBoundingClientRect();
|
|
5525
|
+
if (optsRef.current.persist === false) return;
|
|
5282
5526
|
if (drag.kind === "move") {
|
|
5283
5527
|
writePanelBox(itemKey, kind, { pos: {
|
|
5284
5528
|
left: Math.round(rect.left),
|
|
@@ -5400,6 +5644,50 @@ function itemTypeLabel(t, itemType) {
|
|
|
5400
5644
|
const label = t(key);
|
|
5401
5645
|
return label === "" || label === key ? itemType : label;
|
|
5402
5646
|
}
|
|
5647
|
+
/**
|
|
5648
|
+
* 子项形态 → 图标(16×16 viewBox)。
|
|
5649
|
+
*
|
|
5650
|
+
* 与条目类型图标同一套单线描边,但形态更具体:PDF 是有角标的纸页并在页内写
|
|
5651
|
+
* `PDF`,网页快照是浏览器窗口,网页链接是地球,笔记是横线纸,其余是普通文档。
|
|
5652
|
+
* 颜色仍在 `styles.ts` 的 `THEME_CSS` 里统一管。
|
|
5653
|
+
*/
|
|
5654
|
+
const CHILD_KIND_PATH = {
|
|
5655
|
+
pdf: "M4 2.4h5l3 3v8.2H4z M9 2.4v3h3",
|
|
5656
|
+
snapshot: "M2.4 3.2h11.2v9.6H2.4z M2.4 5.8h11.2 M4 4.5h.6 M5.7 4.5h.6 M4.4 8.3h3.8 M4.4 10.4h5.2",
|
|
5657
|
+
webpage: "M8 2.6c3 0 5.4 2.4 5.4 5.4S11 13.4 8 13.4 2.6 11 2.6 8 5 2.6 8 2.6z M2.9 8h10.2 M8 2.7c1.5 1.6 2.2 3.4 2.2 5.3S9.5 11.8 8 13.3 M8 2.7C6.5 4.3 5.8 6.1 5.8 8s.7 3.9 2.2 5.3",
|
|
5658
|
+
note: "M4.2 2.6h7.6v10.8H4.2z M4.2 5.4h7.6 M6 7.8h4 M6 10.1h4",
|
|
5659
|
+
file: "M4.5 2.5h5l3 3v8h-8z M9.5 2.5v3h3 M6.5 8h4.5 M6.5 10.5h4.5"
|
|
5660
|
+
};
|
|
5661
|
+
/** 条目列表子项(附件 / 笔记)图标;`pdf` 额外在页内印三个字母。 */
|
|
5662
|
+
function ChildKindIcon({ kind, read = false, size = 15 }) {
|
|
5663
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
|
|
5664
|
+
width: size,
|
|
5665
|
+
height: size,
|
|
5666
|
+
viewBox: "0 0 16 16",
|
|
5667
|
+
fill: "none",
|
|
5668
|
+
stroke: "currentColor",
|
|
5669
|
+
strokeWidth: 1.2,
|
|
5670
|
+
strokeLinejoin: "round",
|
|
5671
|
+
strokeLinecap: "round",
|
|
5672
|
+
className: childKindIconClass(kind, read),
|
|
5673
|
+
"aria-hidden": true,
|
|
5674
|
+
focusable: "false",
|
|
5675
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: CHILD_KIND_PATH[kind] }), kind === "pdf" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("text", {
|
|
5676
|
+
x: 8,
|
|
5677
|
+
y: 11.6,
|
|
5678
|
+
textAnchor: "middle",
|
|
5679
|
+
fontSize: 4.1,
|
|
5680
|
+
fontWeight: 700,
|
|
5681
|
+
fill: "currentColor",
|
|
5682
|
+
stroke: "none",
|
|
5683
|
+
children: "PDF"
|
|
5684
|
+
})]
|
|
5685
|
+
});
|
|
5686
|
+
}
|
|
5687
|
+
/** 子项形态的本地化名称,用于展开行与副标题计数的悬停提示。 */
|
|
5688
|
+
function childKindLabel(t, kind) {
|
|
5689
|
+
return t(`list.childKind.${kind}`);
|
|
5690
|
+
}
|
|
5403
5691
|
//#endregion
|
|
5404
5692
|
//#region src/client/NoteEditor.tsx
|
|
5405
5693
|
/**
|
|
@@ -5684,7 +5972,7 @@ const NoteEditor = (0, react.forwardRef)(function NoteEditor({ html, onDirty, on
|
|
|
5684
5972
|
"aria-label": ariaLabel ?? t("note.new"),
|
|
5685
5973
|
"data-placeholder": placeholder ?? "",
|
|
5686
5974
|
style: {
|
|
5687
|
-
...bodyStyle$
|
|
5975
|
+
...bodyStyle$4,
|
|
5688
5976
|
minHeight
|
|
5689
5977
|
},
|
|
5690
5978
|
onInput: onDirty,
|
|
@@ -5758,7 +6046,7 @@ const toolbarStyle = {
|
|
|
5758
6046
|
* 夹在中间可以两全:短笔记是一大片能直接写的区域,不缩成一条;长笔记也不会把整块
|
|
5759
6047
|
* 面板撞飞,超过上限后在框内滚。
|
|
5760
6048
|
*/
|
|
5761
|
-
const bodyStyle$
|
|
6049
|
+
const bodyStyle$4 = {
|
|
5762
6050
|
padding: "6px 8px",
|
|
5763
6051
|
fontSize: 12.5,
|
|
5764
6052
|
lineHeight: 1.75,
|
|
@@ -5798,7 +6086,7 @@ const highlightLabelStyle = {
|
|
|
5798
6086
|
*/
|
|
5799
6087
|
/** 输入停止多久后自动写回。太短会把每次停顿都变成一次 PATCH。 */
|
|
5800
6088
|
const SAVE_DELAY = 800;
|
|
5801
|
-
function errorMessage$
|
|
6089
|
+
function errorMessage$3(error) {
|
|
5802
6090
|
return error instanceof Error ? error.message : String(error);
|
|
5803
6091
|
}
|
|
5804
6092
|
function NoteList({ t, notes, itemKey, canWrite, selfNote, composing, onComposingChange, onInsert, onChanged }) {
|
|
@@ -5844,7 +6132,7 @@ function NoteComposer({ t, itemKey, onCancel, onCreated }) {
|
|
|
5844
6132
|
onCreated();
|
|
5845
6133
|
onCancel();
|
|
5846
6134
|
} catch (error) {
|
|
5847
|
-
setNotice(tpl(t("note.writeFailed"), { message: errorMessage$
|
|
6135
|
+
setNotice(tpl(t("note.writeFailed"), { message: errorMessage$3(error) }));
|
|
5848
6136
|
} finally {
|
|
5849
6137
|
setBusy(false);
|
|
5850
6138
|
}
|
|
@@ -5925,7 +6213,7 @@ function NoteItem({ t, note, canWrite, onInsert, onChanged, onOpenEditor }) {
|
|
|
5925
6213
|
if (fresh.version > version.current) version.current = fresh.version;
|
|
5926
6214
|
if (alive.current) setRaw(fresh.html);
|
|
5927
6215
|
} catch (error) {
|
|
5928
|
-
if (alive.current) setNotice(tpl(t("note.readFailed"), { message: errorMessage$
|
|
6216
|
+
if (alive.current) setNotice(tpl(t("note.readFailed"), { message: errorMessage$3(error) }));
|
|
5929
6217
|
} finally {
|
|
5930
6218
|
if (alive.current) setLoading(false);
|
|
5931
6219
|
}
|
|
@@ -5987,7 +6275,7 @@ function NoteItem({ t, note, canWrite, onInsert, onChanged, onOpenEditor }) {
|
|
|
5987
6275
|
} catch (error) {
|
|
5988
6276
|
if (alive.current) {
|
|
5989
6277
|
setStatus("idle");
|
|
5990
|
-
setNotice(tpl(t("note.writeFailed"), { message: errorMessage$
|
|
6278
|
+
setNotice(tpl(t("note.writeFailed"), { message: errorMessage$3(error) }));
|
|
5991
6279
|
}
|
|
5992
6280
|
} finally {
|
|
5993
6281
|
inflight.current = false;
|
|
@@ -6037,7 +6325,7 @@ function NoteItem({ t, note, canWrite, onInsert, onChanged, onOpenEditor }) {
|
|
|
6037
6325
|
showToast(t("note.deleted"));
|
|
6038
6326
|
onChanged();
|
|
6039
6327
|
} catch (error) {
|
|
6040
|
-
if (alive.current) setNotice(tpl(t("note.writeFailed"), { message: errorMessage$
|
|
6328
|
+
if (alive.current) setNotice(tpl(t("note.writeFailed"), { message: errorMessage$3(error) }));
|
|
6041
6329
|
} finally {
|
|
6042
6330
|
if (alive.current) setRemoving(false);
|
|
6043
6331
|
}
|
|
@@ -6108,7 +6396,7 @@ function NoteItem({ t, note, canWrite, onInsert, onChanged, onOpenEditor }) {
|
|
|
6108
6396
|
]
|
|
6109
6397
|
}),
|
|
6110
6398
|
open && loading && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
6111
|
-
style: hintStyle$
|
|
6399
|
+
style: hintStyle$9,
|
|
6112
6400
|
children: t("note.loading")
|
|
6113
6401
|
}),
|
|
6114
6402
|
open && !loading && raw === null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
@@ -6254,7 +6542,7 @@ const anchorHintStyle = {
|
|
|
6254
6542
|
color: "#d29922",
|
|
6255
6543
|
textAlign: "right"
|
|
6256
6544
|
};
|
|
6257
|
-
const hintStyle$
|
|
6545
|
+
const hintStyle$9 = {
|
|
6258
6546
|
marginTop: 6,
|
|
6259
6547
|
fontSize: 11.5,
|
|
6260
6548
|
opacity: .6
|
|
@@ -6347,9 +6635,9 @@ function InfoPanel({ t, detail, currentAttachmentKey, open, onToggle, onClose, o
|
|
|
6347
6635
|
anchorRef: rootRef,
|
|
6348
6636
|
itemKey: detail.key,
|
|
6349
6637
|
kind: "info",
|
|
6350
|
-
width: PANEL_WIDTH$
|
|
6351
|
-
minWidth: PANEL_MIN_WIDTH$
|
|
6352
|
-
minHeight: PANEL_MIN_HEIGHT$
|
|
6638
|
+
width: PANEL_WIDTH$2,
|
|
6639
|
+
minWidth: PANEL_MIN_WIDTH$2,
|
|
6640
|
+
minHeight: PANEL_MIN_HEIGHT$2
|
|
6353
6641
|
});
|
|
6354
6642
|
(0, react.useEffect)(() => {
|
|
6355
6643
|
setComposingNote(false);
|
|
@@ -6406,7 +6694,7 @@ function InfoPanel({ t, detail, currentAttachmentKey, open, onToggle, onClose, o
|
|
|
6406
6694
|
const notes = detail.notes;
|
|
6407
6695
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
6408
6696
|
ref: rootRef,
|
|
6409
|
-
style: rootStyle$
|
|
6697
|
+
style: rootStyle$8,
|
|
6410
6698
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
6411
6699
|
ref: rowRef,
|
|
6412
6700
|
style: rowStyle$3,
|
|
@@ -6445,12 +6733,12 @@ function InfoPanel({ t, detail, currentAttachmentKey, open, onToggle, onClose, o
|
|
|
6445
6733
|
"aria-label": t("detail.info"),
|
|
6446
6734
|
...box.panelProps,
|
|
6447
6735
|
style: {
|
|
6448
|
-
...panelStyle$
|
|
6736
|
+
...panelStyle$2,
|
|
6449
6737
|
...box.style
|
|
6450
6738
|
},
|
|
6451
6739
|
children: [
|
|
6452
6740
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
6453
|
-
style: panelHeaderStyle$
|
|
6741
|
+
style: panelHeaderStyle$2,
|
|
6454
6742
|
...box.moveProps,
|
|
6455
6743
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
6456
6744
|
style: panelTitleStyle,
|
|
@@ -6470,11 +6758,11 @@ function InfoPanel({ t, detail, currentAttachmentKey, open, onToggle, onClose, o
|
|
|
6470
6758
|
opacity: pinned ? 1 : .5,
|
|
6471
6759
|
background: pinHovered ? "rgba(127,127,127,0.16)" : "transparent"
|
|
6472
6760
|
},
|
|
6473
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PinIcon$
|
|
6761
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PinIcon$2, { filled: pinned })
|
|
6474
6762
|
})]
|
|
6475
6763
|
}),
|
|
6476
6764
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
6477
|
-
style: bodyStyle$
|
|
6765
|
+
style: bodyStyle$3,
|
|
6478
6766
|
children: [
|
|
6479
6767
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Block, {
|
|
6480
6768
|
label: t("detail.metadata"),
|
|
@@ -6605,15 +6893,15 @@ function InfoPanel({ t, detail, currentAttachmentKey, open, onToggle, onClose, o
|
|
|
6605
6893
|
"aria-hidden": "true",
|
|
6606
6894
|
title: t("detail.resize"),
|
|
6607
6895
|
...box.resizeProps,
|
|
6608
|
-
style: resizeHandleStyle$
|
|
6609
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ResizeIcon$
|
|
6896
|
+
style: resizeHandleStyle$3,
|
|
6897
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ResizeIcon$2, {})
|
|
6610
6898
|
})
|
|
6611
6899
|
]
|
|
6612
6900
|
})]
|
|
6613
6901
|
});
|
|
6614
6902
|
}
|
|
6615
6903
|
/** 图钉:帽 + 针。钉住时实心(`ACCENT`),未钉住只描边。 */
|
|
6616
|
-
function PinIcon$
|
|
6904
|
+
function PinIcon$2({ filled }) {
|
|
6617
6905
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
|
|
6618
6906
|
width: "12",
|
|
6619
6907
|
height: "12",
|
|
@@ -6635,7 +6923,7 @@ function PinIcon$1({ filled }) {
|
|
|
6635
6923
|
});
|
|
6636
6924
|
}
|
|
6637
6925
|
/** 右下角的缩放把手:两条 45° 短线。 */
|
|
6638
|
-
function ResizeIcon$
|
|
6926
|
+
function ResizeIcon$2() {
|
|
6639
6927
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
|
|
6640
6928
|
width: "10",
|
|
6641
6929
|
height: "10",
|
|
@@ -6662,7 +6950,7 @@ function ResizeIcon$1() {
|
|
|
6662
6950
|
* 消息与粘性输入区;又不该高过宿主的对话框(那类通常 ≥ 1000)。这一层不画东西、
|
|
6663
6951
|
* `pointerEvents:none`,抬高层级不会挡任何点击。
|
|
6664
6952
|
*/
|
|
6665
|
-
const rootStyle$
|
|
6953
|
+
const rootStyle$8 = {
|
|
6666
6954
|
position: "absolute",
|
|
6667
6955
|
inset: 0,
|
|
6668
6956
|
zIndex: 300,
|
|
@@ -6699,15 +6987,15 @@ const triggerStyle$1 = {
|
|
|
6699
6987
|
zIndex: 21
|
|
6700
6988
|
};
|
|
6701
6989
|
/** 初始宽度;比原来浮在正文里的 320 宽一点,长标题与元数据少折行。 */
|
|
6702
|
-
const PANEL_WIDTH$
|
|
6703
|
-
const PANEL_MIN_WIDTH$
|
|
6704
|
-
const PANEL_MIN_HEIGHT$
|
|
6990
|
+
const PANEL_WIDTH$2 = 360;
|
|
6991
|
+
const PANEL_MIN_WIDTH$2 = 280;
|
|
6992
|
+
const PANEL_MIN_HEIGHT$2 = 240;
|
|
6705
6993
|
/**
|
|
6706
6994
|
* 面板本体:`fixed`,几何由 `floatingBox` 注入(`...box.style` 覆盖在最后)。
|
|
6707
6995
|
*
|
|
6708
6996
|
* 纵向 flex:标题栏固定、区块区滚动,右下角把手才不会被内容带着跑。
|
|
6709
6997
|
*/
|
|
6710
|
-
const panelStyle$
|
|
6998
|
+
const panelStyle$2 = {
|
|
6711
6999
|
position: "fixed",
|
|
6712
7000
|
pointerEvents: "auto",
|
|
6713
7001
|
display: "flex",
|
|
@@ -6724,7 +7012,7 @@ const panelStyle$1 = {
|
|
|
6724
7012
|
zIndex: 300
|
|
6725
7013
|
};
|
|
6726
7014
|
/** 区块区:自己滚,别把标题栏与把手一起卷走。 */
|
|
6727
|
-
const bodyStyle$
|
|
7015
|
+
const bodyStyle$3 = {
|
|
6728
7016
|
flex: 1,
|
|
6729
7017
|
minHeight: 0,
|
|
6730
7018
|
overflow: "auto",
|
|
@@ -6733,7 +7021,7 @@ const bodyStyle$2 = {
|
|
|
6733
7021
|
paddingBottom: 6
|
|
6734
7022
|
};
|
|
6735
7023
|
/** 标题栏兼拖动把手。 */
|
|
6736
|
-
const panelHeaderStyle$
|
|
7024
|
+
const panelHeaderStyle$2 = {
|
|
6737
7025
|
display: "flex",
|
|
6738
7026
|
alignItems: "flex-start",
|
|
6739
7027
|
gap: 6,
|
|
@@ -6760,7 +7048,7 @@ const pinStyle$1 = {
|
|
|
6760
7048
|
transition: "background-color 120ms ease"
|
|
6761
7049
|
};
|
|
6762
7050
|
/** 缩放把手:贴在右下角,盖在滚动区之上。 */
|
|
6763
|
-
const resizeHandleStyle$
|
|
7051
|
+
const resizeHandleStyle$3 = {
|
|
6764
7052
|
position: "absolute",
|
|
6765
7053
|
right: 2,
|
|
6766
7054
|
bottom: 2,
|
|
@@ -6918,9 +7206,9 @@ const attachmentMetaStyle = {
|
|
|
6918
7206
|
const INDENT$1 = 13;
|
|
6919
7207
|
const MAX_INDENT_DEPTH = 6;
|
|
6920
7208
|
/** 初始宽度;左侧挤不下时由 `floatingBox` 收窄或退回右栏内。 */
|
|
6921
|
-
const PANEL_WIDTH = 360;
|
|
6922
|
-
const PANEL_MIN_WIDTH = 260;
|
|
6923
|
-
const PANEL_MIN_HEIGHT = 200;
|
|
7209
|
+
const PANEL_WIDTH$1 = 360;
|
|
7210
|
+
const PANEL_MIN_WIDTH$1 = 260;
|
|
7211
|
+
const PANEL_MIN_HEIGHT$1 = 200;
|
|
6924
7212
|
/** 用户自己滚过目录后,这么久之内不再把高亮行带回可视区(别抢滚动)。 */
|
|
6925
7213
|
const FOLLOW_HOLD_MS = 2500;
|
|
6926
7214
|
function OutlinePanel({ t, itemKey, items, sourceLabel, activeIndex, open, onToggle, onClose, onJump }) {
|
|
@@ -6944,9 +7232,9 @@ function OutlinePanel({ t, itemKey, items, sourceLabel, activeIndex, open, onTog
|
|
|
6944
7232
|
anchorRef: rootRef,
|
|
6945
7233
|
itemKey,
|
|
6946
7234
|
kind: "outline",
|
|
6947
|
-
width: PANEL_WIDTH,
|
|
6948
|
-
minWidth: PANEL_MIN_WIDTH,
|
|
6949
|
-
minHeight: PANEL_MIN_HEIGHT
|
|
7235
|
+
width: PANEL_WIDTH$1,
|
|
7236
|
+
minWidth: PANEL_MIN_WIDTH$1,
|
|
7237
|
+
minHeight: PANEL_MIN_HEIGHT$1
|
|
6950
7238
|
});
|
|
6951
7239
|
useDismiss(open, box.panelRef, onClose, {
|
|
6952
7240
|
pinned,
|
|
@@ -6985,7 +7273,7 @@ function OutlinePanel({ t, itemKey, items, sourceLabel, activeIndex, open, onTog
|
|
|
6985
7273
|
]);
|
|
6986
7274
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
6987
7275
|
ref: rootRef,
|
|
6988
|
-
style: rootStyle$
|
|
7276
|
+
style: rootStyle$7,
|
|
6989
7277
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
6990
7278
|
ref: triggerRef,
|
|
6991
7279
|
type: "button",
|
|
@@ -7004,12 +7292,12 @@ function OutlinePanel({ t, itemKey, items, sourceLabel, activeIndex, open, onTog
|
|
|
7004
7292
|
"aria-label": t("outline.title"),
|
|
7005
7293
|
...box.panelProps,
|
|
7006
7294
|
style: {
|
|
7007
|
-
...panelStyle,
|
|
7295
|
+
...panelStyle$1,
|
|
7008
7296
|
...box.style
|
|
7009
7297
|
},
|
|
7010
7298
|
children: [
|
|
7011
7299
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
7012
|
-
style: panelHeaderStyle,
|
|
7300
|
+
style: panelHeaderStyle$1,
|
|
7013
7301
|
...box.moveProps,
|
|
7014
7302
|
children: [
|
|
7015
7303
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("outline.title") }),
|
|
@@ -7032,7 +7320,7 @@ function OutlinePanel({ t, itemKey, items, sourceLabel, activeIndex, open, onTog
|
|
|
7032
7320
|
opacity: pinned ? 1 : .5,
|
|
7033
7321
|
background: pinHovered ? "rgba(127,127,127,0.16)" : "transparent"
|
|
7034
7322
|
},
|
|
7035
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PinIcon, { filled: pinned })
|
|
7323
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PinIcon$1, { filled: pinned })
|
|
7036
7324
|
})
|
|
7037
7325
|
]
|
|
7038
7326
|
}),
|
|
@@ -7092,8 +7380,8 @@ function OutlinePanel({ t, itemKey, items, sourceLabel, activeIndex, open, onTog
|
|
|
7092
7380
|
"aria-hidden": "true",
|
|
7093
7381
|
title: t("outline.resize"),
|
|
7094
7382
|
...box.resizeProps,
|
|
7095
|
-
style: resizeHandleStyle$
|
|
7096
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ResizeIcon, {})
|
|
7383
|
+
style: resizeHandleStyle$2,
|
|
7384
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ResizeIcon$1, {})
|
|
7097
7385
|
})
|
|
7098
7386
|
]
|
|
7099
7387
|
})]
|
|
@@ -7127,7 +7415,7 @@ function ListIcon() {
|
|
|
7127
7415
|
});
|
|
7128
7416
|
}
|
|
7129
7417
|
/** 图钉:帽 + 针。钉住时实心(`ACCENT`),未钉住只描边。 */
|
|
7130
|
-
function PinIcon({ filled }) {
|
|
7418
|
+
function PinIcon$1({ filled }) {
|
|
7131
7419
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
|
|
7132
7420
|
width: "12",
|
|
7133
7421
|
height: "12",
|
|
@@ -7155,7 +7443,7 @@ function PinIcon({ filled }) {
|
|
|
7155
7443
|
* 又不该高过宿主的对话框(那类通常 ≥ 1000)。这一层不画东西、`pointerEvents:none`,
|
|
7156
7444
|
* 抬高层级不会挡任何点击。
|
|
7157
7445
|
*/
|
|
7158
|
-
const rootStyle$
|
|
7446
|
+
const rootStyle$7 = {
|
|
7159
7447
|
position: "absolute",
|
|
7160
7448
|
inset: 0,
|
|
7161
7449
|
zIndex: 300,
|
|
@@ -7182,7 +7470,7 @@ const triggerStyle = {
|
|
|
7182
7470
|
zIndex: 21
|
|
7183
7471
|
};
|
|
7184
7472
|
/** 右下角的缩放把手:两条 45° 短线,够小、不抢目录的视觉。 */
|
|
7185
|
-
function ResizeIcon() {
|
|
7473
|
+
function ResizeIcon$1() {
|
|
7186
7474
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
|
|
7187
7475
|
width: "10",
|
|
7188
7476
|
height: "10",
|
|
@@ -7208,7 +7496,7 @@ function ResizeIcon() {
|
|
|
7208
7496
|
* `zIndex` 要压过聊天区(含输入框的粘性层),但不能高到盖住宿主自己的对话框
|
|
7209
7497
|
* (设置页那类通常 ≥ 1000)。
|
|
7210
7498
|
*/
|
|
7211
|
-
const panelStyle = {
|
|
7499
|
+
const panelStyle$1 = {
|
|
7212
7500
|
position: "fixed",
|
|
7213
7501
|
pointerEvents: "auto",
|
|
7214
7502
|
display: "flex",
|
|
@@ -7225,7 +7513,7 @@ const panelStyle = {
|
|
|
7225
7513
|
zIndex: 300
|
|
7226
7514
|
};
|
|
7227
7515
|
/** 标题栏兼拖动把手:`cursor: move` 给个信号,拖动期间别顺手选中标题文字。 */
|
|
7228
|
-
const panelHeaderStyle = {
|
|
7516
|
+
const panelHeaderStyle$1 = {
|
|
7229
7517
|
display: "flex",
|
|
7230
7518
|
alignItems: "center",
|
|
7231
7519
|
gap: 6,
|
|
@@ -7277,7 +7565,7 @@ const listStyle = {
|
|
|
7277
7565
|
paddingBottom: 8
|
|
7278
7566
|
};
|
|
7279
7567
|
/** 缩放把手:贴在右下角,盖在列表之上。 */
|
|
7280
|
-
const resizeHandleStyle$
|
|
7568
|
+
const resizeHandleStyle$2 = {
|
|
7281
7569
|
position: "absolute",
|
|
7282
7570
|
right: 2,
|
|
7283
7571
|
bottom: 2,
|
|
@@ -30844,7 +31132,7 @@ function AnnotationCard({ t, annotation, style, cardRef, canEdit, onClose, onIns
|
|
|
30844
31132
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
30845
31133
|
type: "button",
|
|
30846
31134
|
onClick: onClose,
|
|
30847
|
-
style: iconButtonStyle$
|
|
31135
|
+
style: iconButtonStyle$2,
|
|
30848
31136
|
"aria-label": t("viewer.close"),
|
|
30849
31137
|
children: "×"
|
|
30850
31138
|
})
|
|
@@ -30877,7 +31165,7 @@ function AnnotationCard({ t, annotation, style, cardRef, canEdit, onClose, onIns
|
|
|
30877
31165
|
style: textareaStyle
|
|
30878
31166
|
}),
|
|
30879
31167
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
30880
|
-
style: hintStyle$
|
|
31168
|
+
style: hintStyle$8,
|
|
30881
31169
|
children: t("annotation.commentHint")
|
|
30882
31170
|
}),
|
|
30883
31171
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
@@ -31037,7 +31325,7 @@ const swatchStyle$1 = {
|
|
|
31037
31325
|
border: "none",
|
|
31038
31326
|
cursor: "pointer"
|
|
31039
31327
|
};
|
|
31040
|
-
const iconButtonStyle$
|
|
31328
|
+
const iconButtonStyle$2 = {
|
|
31041
31329
|
width: 20,
|
|
31042
31330
|
height: 20,
|
|
31043
31331
|
padding: 0,
|
|
@@ -31063,7 +31351,7 @@ const textareaStyle = {
|
|
|
31063
31351
|
fontFamily: "inherit",
|
|
31064
31352
|
resize: "vertical"
|
|
31065
31353
|
};
|
|
31066
|
-
const hintStyle$
|
|
31354
|
+
const hintStyle$8 = {
|
|
31067
31355
|
marginTop: 4,
|
|
31068
31356
|
fontSize: 10.5,
|
|
31069
31357
|
lineHeight: 1.5,
|
|
@@ -32266,7 +32554,7 @@ function TranslationCard({ t, view, bounds, engine, onEngineChange, onClose, onR
|
|
|
32266
32554
|
children: targetLabel
|
|
32267
32555
|
})]
|
|
32268
32556
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
32269
|
-
style: bodyStyle$
|
|
32557
|
+
style: bodyStyle$2,
|
|
32270
32558
|
children: [
|
|
32271
32559
|
view.status === "loading" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
32272
32560
|
style: statusStyle,
|
|
@@ -32318,7 +32606,7 @@ function TranslationCard({ t, view, bounds, engine, onEngineChange, onClose, onR
|
|
|
32318
32606
|
onPointerMove: onResizeMove,
|
|
32319
32607
|
onPointerUp: onResizeUp,
|
|
32320
32608
|
onPointerCancel: onResizeUp,
|
|
32321
|
-
style: resizeHandleStyle,
|
|
32609
|
+
style: resizeHandleStyle$1,
|
|
32322
32610
|
title: t("translate.resizeHint"),
|
|
32323
32611
|
"aria-label": t("translate.resizeHint"),
|
|
32324
32612
|
role: "separator"
|
|
@@ -32500,7 +32788,7 @@ const dividerStyle = {
|
|
|
32500
32788
|
background: "light-dark(#8593a8, #78859a)"
|
|
32501
32789
|
};
|
|
32502
32790
|
/** 右栏正文区:吃掉栏目标题之外的全部高度。 */
|
|
32503
|
-
const bodyStyle$
|
|
32791
|
+
const bodyStyle$2 = {
|
|
32504
32792
|
flex: 1,
|
|
32505
32793
|
minHeight: 0,
|
|
32506
32794
|
display: "flex",
|
|
@@ -32533,7 +32821,7 @@ const footerStyle = {
|
|
|
32533
32821
|
paddingRight: 10
|
|
32534
32822
|
};
|
|
32535
32823
|
/** 右下角缩放把手:两条斜线示意「可以拉」,命中区比图形略大。 */
|
|
32536
|
-
const resizeHandleStyle = {
|
|
32824
|
+
const resizeHandleStyle$1 = {
|
|
32537
32825
|
position: "absolute",
|
|
32538
32826
|
right: 0,
|
|
32539
32827
|
bottom: 0,
|
|
@@ -33851,7 +34139,7 @@ function PdfViewer(props) {
|
|
|
33851
34139
|
}
|
|
33852
34140
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
33853
34141
|
ref: rootRef,
|
|
33854
|
-
style: rootStyle$
|
|
34142
|
+
style: rootStyle$6,
|
|
33855
34143
|
children: [
|
|
33856
34144
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("style", { children: PDF_CSS }),
|
|
33857
34145
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
@@ -33961,7 +34249,7 @@ function PdfViewer(props) {
|
|
|
33961
34249
|
]
|
|
33962
34250
|
});
|
|
33963
34251
|
}
|
|
33964
|
-
const rootStyle$
|
|
34252
|
+
const rootStyle$6 = {
|
|
33965
34253
|
position: "relative",
|
|
33966
34254
|
height: "100%",
|
|
33967
34255
|
minHeight: 0
|
|
@@ -37232,7 +37520,7 @@ function SnapshotViewer({ t, detail, source, annotations, viewerRef, onReady, on
|
|
|
37232
37520
|
const cardAbove = card !== null && card.y > rootHeight * .55;
|
|
37233
37521
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
37234
37522
|
ref: rootRef,
|
|
37235
|
-
style: rootStyle$
|
|
37523
|
+
style: rootStyle$5,
|
|
37236
37524
|
children: [
|
|
37237
37525
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("iframe", {
|
|
37238
37526
|
ref: frameRef,
|
|
@@ -37329,7 +37617,7 @@ function barPosition(selection, frame, root) {
|
|
|
37329
37617
|
y: Math.max(36, offsetY + selection.rect.top)
|
|
37330
37618
|
};
|
|
37331
37619
|
}
|
|
37332
|
-
const rootStyle$
|
|
37620
|
+
const rootStyle$5 = {
|
|
37333
37621
|
position: "relative",
|
|
37334
37622
|
height: "100%",
|
|
37335
37623
|
minHeight: 0,
|
|
@@ -37691,7 +37979,7 @@ function TextViewer({ t, detail, annotations, viewerRef, onReady, onInsertExcerp
|
|
|
37691
37979
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
37692
37980
|
ref: boxRef,
|
|
37693
37981
|
onMouseUp: handleMouseUp,
|
|
37694
|
-
style: rootStyle$
|
|
37982
|
+
style: rootStyle$4,
|
|
37695
37983
|
children: [
|
|
37696
37984
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("style", { children: TEXT_CSS + NOTE_CSS }),
|
|
37697
37985
|
!hasContent ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
@@ -37748,7 +38036,7 @@ function TextViewer({ t, detail, annotations, viewerRef, onReady, onInsertExcerp
|
|
|
37748
38036
|
]
|
|
37749
38037
|
});
|
|
37750
38038
|
}
|
|
37751
|
-
const rootStyle$
|
|
38039
|
+
const rootStyle$4 = {
|
|
37752
38040
|
position: "relative",
|
|
37753
38041
|
height: "100%",
|
|
37754
38042
|
minHeight: 0,
|
|
@@ -37824,9 +38112,9 @@ function WebpageViewer(props) {
|
|
|
37824
38112
|
const linked = safeHttpUrl(detail.url);
|
|
37825
38113
|
const hasText = detail.fulltext !== null;
|
|
37826
38114
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
37827
|
-
style: rootStyle$
|
|
38115
|
+
style: rootStyle$3,
|
|
37828
38116
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
37829
|
-
style: hintStyle$
|
|
38117
|
+
style: hintStyle$7,
|
|
37830
38118
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
37831
38119
|
style: hintTextStyle,
|
|
37832
38120
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { children: hasText ? t("detail.noSnapshotHint") : t("detail.noSnapshot") }), !hasText && detail.url !== "" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
@@ -37841,18 +38129,18 @@ function WebpageViewer(props) {
|
|
|
37841
38129
|
children: t("detail.openOriginal")
|
|
37842
38130
|
})]
|
|
37843
38131
|
}), hasText && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
37844
|
-
style: bodyStyle,
|
|
38132
|
+
style: bodyStyle$1,
|
|
37845
38133
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TextViewer, { ...props })
|
|
37846
38134
|
})]
|
|
37847
38135
|
});
|
|
37848
38136
|
}
|
|
37849
|
-
const rootStyle$
|
|
38137
|
+
const rootStyle$3 = {
|
|
37850
38138
|
display: "flex",
|
|
37851
38139
|
flexDirection: "column",
|
|
37852
38140
|
height: "100%",
|
|
37853
38141
|
minHeight: 0
|
|
37854
38142
|
};
|
|
37855
|
-
const hintStyle$
|
|
38143
|
+
const hintStyle$7 = {
|
|
37856
38144
|
flexShrink: 0,
|
|
37857
38145
|
display: "flex",
|
|
37858
38146
|
alignItems: "flex-start",
|
|
@@ -37882,7 +38170,7 @@ const linkStyle = {
|
|
|
37882
38170
|
textDecoration: "none",
|
|
37883
38171
|
whiteSpace: "nowrap"
|
|
37884
38172
|
};
|
|
37885
|
-
const bodyStyle = {
|
|
38173
|
+
const bodyStyle$1 = {
|
|
37886
38174
|
flex: 1,
|
|
37887
38175
|
minHeight: 0,
|
|
37888
38176
|
position: "relative"
|
|
@@ -38048,7 +38336,7 @@ function ScreenshotOverlay({ t, url, width, height, selection, busy, onSelect, o
|
|
|
38048
38336
|
const buttonLeft = shown !== null ? clamp(shown.left, 4, Math.max(4, width - 150)) : 0;
|
|
38049
38337
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
38050
38338
|
ref: rootRef,
|
|
38051
|
-
style: rootStyle$
|
|
38339
|
+
style: rootStyle$2,
|
|
38052
38340
|
onPointerDown,
|
|
38053
38341
|
onPointerMove,
|
|
38054
38342
|
onPointerUp,
|
|
@@ -38074,7 +38362,7 @@ function ScreenshotOverlay({ t, url, width, height, selection, busy, onSelect, o
|
|
|
38074
38362
|
height: shown.height
|
|
38075
38363
|
} }),
|
|
38076
38364
|
shown === null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
38077
|
-
style: hintStyle$
|
|
38365
|
+
style: hintStyle$6,
|
|
38078
38366
|
children: t("shot.hint")
|
|
38079
38367
|
}),
|
|
38080
38368
|
shown !== null && shown.width > 0 && shown.height > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
@@ -38117,7 +38405,7 @@ function ScreenshotOverlay({ t, url, width, height, selection, busy, onSelect, o
|
|
|
38117
38405
|
* `zIndex` 要压过左上角那组悬浮按钮(它们在 `zIndex: 300` 的透明层里,为了能画到
|
|
38118
38406
|
* 右栏外面去),否则定格之后按钮仍浮在图上方、还会挡住正文左上角那一片的框选。
|
|
38119
38407
|
*/
|
|
38120
|
-
const rootStyle$
|
|
38408
|
+
const rootStyle$2 = {
|
|
38121
38409
|
position: "absolute",
|
|
38122
38410
|
inset: 0,
|
|
38123
38411
|
zIndex: 400,
|
|
@@ -38150,7 +38438,7 @@ const cutStyle = {
|
|
|
38150
38438
|
boxShadow: "0 0 0 9999px rgba(0,0,0,0.42)",
|
|
38151
38439
|
pointerEvents: "none"
|
|
38152
38440
|
};
|
|
38153
|
-
const hintStyle$
|
|
38441
|
+
const hintStyle$6 = {
|
|
38154
38442
|
position: "absolute",
|
|
38155
38443
|
left: "50%",
|
|
38156
38444
|
top: "50%",
|
|
@@ -38363,14 +38651,14 @@ function DocumentView({ t, detail, source, annotations, viewerRef, onReady, onIn
|
|
|
38363
38651
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
38364
38652
|
type: "button",
|
|
38365
38653
|
onClick: () => viewerRef.current?.zoomOut(),
|
|
38366
|
-
style: iconButtonStyle,
|
|
38654
|
+
style: iconButtonStyle$1,
|
|
38367
38655
|
"aria-label": t("viewer.zoomOut"),
|
|
38368
38656
|
title: t("viewer.zoomOut"),
|
|
38369
38657
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ZoomIcon, { kind: "out" })
|
|
38370
38658
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
38371
38659
|
type: "button",
|
|
38372
38660
|
onClick: () => viewerRef.current?.zoomIn(),
|
|
38373
|
-
style: iconButtonStyle,
|
|
38661
|
+
style: iconButtonStyle$1,
|
|
38374
38662
|
"aria-label": t("viewer.zoomIn"),
|
|
38375
38663
|
title: t("viewer.zoomIn"),
|
|
38376
38664
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ZoomIcon, { kind: "in" })
|
|
@@ -38516,7 +38804,7 @@ const zoomGroupStyle = {
|
|
|
38516
38804
|
gap: 2
|
|
38517
38805
|
};
|
|
38518
38806
|
/** 无边框图标按钮:放大镜本身当按钮,不再套一层方框。 */
|
|
38519
|
-
const iconButtonStyle = {
|
|
38807
|
+
const iconButtonStyle$1 = {
|
|
38520
38808
|
flexShrink: 0,
|
|
38521
38809
|
display: "inline-flex",
|
|
38522
38810
|
alignItems: "center",
|
|
@@ -39108,7 +39396,7 @@ const OUTLINE_SOURCE_LABEL = {
|
|
|
39108
39396
|
text: "outline.source.text",
|
|
39109
39397
|
webpage: "outline.source.text"
|
|
39110
39398
|
};
|
|
39111
|
-
function errorMessage$
|
|
39399
|
+
function errorMessage$2(error) {
|
|
39112
39400
|
return error instanceof Error ? error.message : String(error);
|
|
39113
39401
|
}
|
|
39114
39402
|
function attachmentSource(attachment) {
|
|
@@ -39303,7 +39591,7 @@ function ItemDetail({ t, detail, onInsertItem, onInsertExcerpt, onInsertTranslat
|
|
|
39303
39591
|
kind: "attachment",
|
|
39304
39592
|
page
|
|
39305
39593
|
}).catch((error) => {
|
|
39306
|
-
showToast(tpl(t("viewer.openFailed"), { message: errorMessage$
|
|
39594
|
+
showToast(tpl(t("viewer.openFailed"), { message: errorMessage$2(error) }));
|
|
39307
39595
|
});
|
|
39308
39596
|
}
|
|
39309
39597
|
/**
|
|
@@ -39326,7 +39614,7 @@ function ItemDetail({ t, detail, onInsertItem, onInsertExcerpt, onInsertTranslat
|
|
|
39326
39614
|
}
|
|
39327
39615
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
39328
39616
|
style: {
|
|
39329
|
-
...rootStyle,
|
|
39617
|
+
...rootStyle$1,
|
|
39330
39618
|
"--dsh-zp-topbar-pad": `${topbarPad}px`
|
|
39331
39619
|
},
|
|
39332
39620
|
children: [
|
|
@@ -39396,7 +39684,7 @@ function ItemDetail({ t, detail, onInsertItem, onInsertExcerpt, onInsertTranslat
|
|
|
39396
39684
|
]
|
|
39397
39685
|
});
|
|
39398
39686
|
}
|
|
39399
|
-
const rootStyle = {
|
|
39687
|
+
const rootStyle$1 = {
|
|
39400
39688
|
position: "relative",
|
|
39401
39689
|
display: "flex",
|
|
39402
39690
|
flexDirection: "column",
|
|
@@ -39676,10 +39964,10 @@ function itemKeyFromAddress(address) {
|
|
|
39676
39964
|
function parseItemKey(info) {
|
|
39677
39965
|
return itemKeyFromAddress(info.tab.navigation?.address || info.tab.contentId || "");
|
|
39678
39966
|
}
|
|
39679
|
-
function errorMessage(error) {
|
|
39967
|
+
function errorMessage$1(error) {
|
|
39680
39968
|
return error instanceof Error ? error.message : String(error);
|
|
39681
39969
|
}
|
|
39682
|
-
const hintStyle$
|
|
39970
|
+
const hintStyle$5 = {
|
|
39683
39971
|
padding: "14px 12px",
|
|
39684
39972
|
opacity: .6,
|
|
39685
39973
|
fontSize: 12.5
|
|
@@ -39711,7 +39999,7 @@ function ZoteroItemPane(props) {
|
|
|
39711
39999
|
setLoading(false);
|
|
39712
40000
|
}).catch((err) => {
|
|
39713
40001
|
if (current !== seq.current || signal.aborted) return;
|
|
39714
|
-
setError(errorMessage(err));
|
|
40002
|
+
setError(errorMessage$1(err));
|
|
39715
40003
|
setLoading(false);
|
|
39716
40004
|
});
|
|
39717
40005
|
}, [
|
|
@@ -39744,7 +40032,7 @@ function ZoteroItemPane(props) {
|
|
|
39744
40032
|
if (source === "manual") showToast(t("detail.refreshed"));
|
|
39745
40033
|
} catch (err) {
|
|
39746
40034
|
if (current !== seq.current || signal.aborted) return;
|
|
39747
|
-
showToast(tpl(t(source === "manual" ? "detail.refreshFailedManual" : "detail.refreshFailed"), { message: errorMessage(err) }));
|
|
40035
|
+
showToast(tpl(t(source === "manual" ? "detail.refreshFailedManual" : "detail.refreshFailed"), { message: errorMessage$1(err) }));
|
|
39748
40036
|
}
|
|
39749
40037
|
}, [
|
|
39750
40038
|
itemKey,
|
|
@@ -39762,12 +40050,12 @@ function ZoteroItemPane(props) {
|
|
|
39762
40050
|
},
|
|
39763
40051
|
children: [itemKey === null ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
39764
40052
|
style: {
|
|
39765
|
-
...hintStyle$
|
|
40053
|
+
...hintStyle$5,
|
|
39766
40054
|
color: "#d29922"
|
|
39767
40055
|
},
|
|
39768
40056
|
children: t("itemTab.invalid")
|
|
39769
40057
|
}) : loading ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
39770
|
-
style: hintStyle$
|
|
40058
|
+
style: hintStyle$5,
|
|
39771
40059
|
children: t("status.loading")
|
|
39772
40060
|
}) : detail === null ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
39773
40061
|
style: {
|
|
@@ -39805,7 +40093,8 @@ function ZoteroItemPane(props) {
|
|
|
39805
40093
|
*
|
|
39806
40094
|
* - 行首三角箭头只管开合,且只在有子分类的行出现;点行体选中该范围。
|
|
39807
40095
|
* - 缩进按层级一次性算出(`depth * INDENT`),不再逐层叠加 margin。
|
|
39808
|
-
* -
|
|
40096
|
+
* - 真实分类与特殊目录(我的出版物 / 未分类条目 / 回收站)右侧显示条目数;
|
|
40097
|
+
* 右键真实分类 → 「添加整目录引用」。
|
|
39809
40098
|
* - 「我的文库」根节点是可选中的全库范围;其下挂三个虚拟分类
|
|
39810
40099
|
* (我的出版物 / 未分类条目 / 回收站),与 Zotero 左侧栏一致。
|
|
39811
40100
|
* - 顶部筛选框只筛目录名(同 Zotero 左栏):命中分类保留、非命中的祖先作为
|
|
@@ -40071,8 +40360,11 @@ function virtualCollection(node, t) {
|
|
|
40071
40360
|
function VirtualRows({ ctx, node, depth }) {
|
|
40072
40361
|
const collection = virtualCollection(node, ctx.t);
|
|
40073
40362
|
const selected = ctx.selectedCollectionKey === collection.key;
|
|
40074
|
-
/**
|
|
40075
|
-
|
|
40363
|
+
/**
|
|
40364
|
+
* 最近阅读读插件自己的进度记录;其余三个特殊目录读后台补的 total。
|
|
40365
|
+
* 数量异步返回,没取到时保持不显示,不让数字把树撑变形。
|
|
40366
|
+
*/
|
|
40367
|
+
const count = node.scope === "recent" ? ctx.recentCount : isVirtualCountScope(node.scope) ? ctx.virtualCounts[node.scope] : void 0;
|
|
40076
40368
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
40077
40369
|
onClick: () => ctx.select(collection),
|
|
40078
40370
|
style: {
|
|
@@ -40099,7 +40391,7 @@ function VirtualRows({ ctx, node, depth }) {
|
|
|
40099
40391
|
});
|
|
40100
40392
|
}
|
|
40101
40393
|
function CollectionTree(props) {
|
|
40102
|
-
const { t, libraryName, collections, treeQuery, selectedCollectionKey, recentCount, onSelectCollection, onInsertCollection } = props;
|
|
40394
|
+
const { t, libraryName, collections, treeQuery, selectedCollectionKey, recentCount, virtualCounts, onSelectCollection, onInsertCollection } = props;
|
|
40103
40395
|
/** 展开集合在 store 里(默认展开根节点),重挂面板后原样恢复。 */
|
|
40104
40396
|
const { expanded } = usePaneState();
|
|
40105
40397
|
const filter = treeQuery.trim().toLowerCase();
|
|
@@ -40114,6 +40406,7 @@ function CollectionTree(props) {
|
|
|
40114
40406
|
filter,
|
|
40115
40407
|
selectedCollectionKey,
|
|
40116
40408
|
recentCount,
|
|
40409
|
+
virtualCounts,
|
|
40117
40410
|
toggle: toggleTreeNode,
|
|
40118
40411
|
select: onSelectCollection,
|
|
40119
40412
|
onInsertCollection
|
|
@@ -40170,7 +40463,7 @@ function CollectionTree(props) {
|
|
|
40170
40463
|
}, node.key)),
|
|
40171
40464
|
filtering && !matched && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
40172
40465
|
style: {
|
|
40173
|
-
...hintStyle$
|
|
40466
|
+
...hintStyle$4,
|
|
40174
40467
|
paddingLeft: 22
|
|
40175
40468
|
},
|
|
40176
40469
|
children: t("tree.emptyFiltered")
|
|
@@ -40178,12 +40471,433 @@ function CollectionTree(props) {
|
|
|
40178
40471
|
] })]
|
|
40179
40472
|
});
|
|
40180
40473
|
}
|
|
40181
|
-
const hintStyle$
|
|
40474
|
+
const hintStyle$4 = {
|
|
40182
40475
|
padding: "6px 8px",
|
|
40183
40476
|
fontSize: 12,
|
|
40184
40477
|
opacity: .6
|
|
40185
40478
|
};
|
|
40186
40479
|
//#endregion
|
|
40480
|
+
//#region src/client/HelpWindow.tsx
|
|
40481
|
+
/**
|
|
40482
|
+
* 面板头部的「使用帮助」教程浮窗。
|
|
40483
|
+
*
|
|
40484
|
+
* 复用 {@link useFloatingBox} + {@link useDismiss}:默认摆在右栏外侧、可拖位置、
|
|
40485
|
+
* 可拖大小、图钉常驻,Esc / 图钉关闭。与目录 / 信息浮层唯一的区别是
|
|
40486
|
+
* `persist: false`——它是面板级的,没有真实 itemKey,几何只在本会话内存里,
|
|
40487
|
+
* 绝不往 view-state 写假条目键。
|
|
40488
|
+
*
|
|
40489
|
+
* 内容分 5 个 tab:快速上手 / 精读与理解 / 笔记整理 / 文库管理 / 截图与标注。
|
|
40490
|
+
* 每条示例给出入口提示与一段可一键复制的提示词,文案全走 locales.ts(zh/en)。
|
|
40491
|
+
*
|
|
40492
|
+
* 面板根必须挂 `{...box.panelProps}`(WINDOW_DRAG_EXCLUDE):macOS 宿主把整行
|
|
40493
|
+
* chrome 当几何拖拽区,浮层压住那行就会变成拖整个 DSH 窗口。
|
|
40494
|
+
*/
|
|
40495
|
+
/** 假 key:`persist: false` 时只作 effect 依赖,不参与几何读写。 */
|
|
40496
|
+
const HELP_BOX_KEY = "__help__";
|
|
40497
|
+
const PANEL_WIDTH = 460;
|
|
40498
|
+
const PANEL_MIN_WIDTH = 340;
|
|
40499
|
+
const PANEL_MIN_HEIGHT = 280;
|
|
40500
|
+
/** 「已复制」显示多久后复位。 */
|
|
40501
|
+
const COPIED_FEEDBACK_MS = 1400;
|
|
40502
|
+
const TABS = [
|
|
40503
|
+
{
|
|
40504
|
+
id: "start",
|
|
40505
|
+
count: 7,
|
|
40506
|
+
withHint: true,
|
|
40507
|
+
footnoteKey: "help.start.footnote"
|
|
40508
|
+
},
|
|
40509
|
+
{
|
|
40510
|
+
id: "reading",
|
|
40511
|
+
count: 4,
|
|
40512
|
+
withHint: false
|
|
40513
|
+
},
|
|
40514
|
+
{
|
|
40515
|
+
id: "notes",
|
|
40516
|
+
count: 3,
|
|
40517
|
+
withHint: false
|
|
40518
|
+
},
|
|
40519
|
+
{
|
|
40520
|
+
id: "library",
|
|
40521
|
+
count: 4,
|
|
40522
|
+
withHint: false
|
|
40523
|
+
},
|
|
40524
|
+
{
|
|
40525
|
+
id: "shots",
|
|
40526
|
+
count: 3,
|
|
40527
|
+
withHint: false
|
|
40528
|
+
}
|
|
40529
|
+
];
|
|
40530
|
+
function HelpWindow({ t, open, anchorRef, triggerRef, onClose }) {
|
|
40531
|
+
const [activeTab, setActiveTab] = (0, react.useState)("start");
|
|
40532
|
+
const [pinned, setPinned] = (0, react.useState)(false);
|
|
40533
|
+
const [pinHovered, setPinHovered] = (0, react.useState)(false);
|
|
40534
|
+
const [copiedKey, setCopiedKey] = (0, react.useState)(null);
|
|
40535
|
+
const copiedTimerRef = (0, react.useRef)(null);
|
|
40536
|
+
const box = useFloatingBox({
|
|
40537
|
+
open,
|
|
40538
|
+
anchorRef,
|
|
40539
|
+
itemKey: HELP_BOX_KEY,
|
|
40540
|
+
kind: "info",
|
|
40541
|
+
persist: false,
|
|
40542
|
+
width: PANEL_WIDTH,
|
|
40543
|
+
minWidth: PANEL_MIN_WIDTH,
|
|
40544
|
+
minHeight: PANEL_MIN_HEIGHT
|
|
40545
|
+
});
|
|
40546
|
+
useDismiss(open, box.panelRef, onClose, {
|
|
40547
|
+
pinned,
|
|
40548
|
+
extraRef: triggerRef
|
|
40549
|
+
});
|
|
40550
|
+
(0, react.useEffect)(() => () => {
|
|
40551
|
+
if (copiedTimerRef.current !== null) window.clearTimeout(copiedTimerRef.current);
|
|
40552
|
+
}, []);
|
|
40553
|
+
function copyPrompt(key, text) {
|
|
40554
|
+
writeClipboard(text).then((ok) => {
|
|
40555
|
+
if (ok) setCopiedKey(key);
|
|
40556
|
+
else {
|
|
40557
|
+
setCopiedKey(null);
|
|
40558
|
+
showToast(t("toast.copyFailed"));
|
|
40559
|
+
}
|
|
40560
|
+
if (copiedTimerRef.current !== null) window.clearTimeout(copiedTimerRef.current);
|
|
40561
|
+
copiedTimerRef.current = window.setTimeout(() => setCopiedKey(null), COPIED_FEEDBACK_MS);
|
|
40562
|
+
});
|
|
40563
|
+
}
|
|
40564
|
+
const tab = TABS.find((spec) => spec.id === activeTab) ?? TABS[0];
|
|
40565
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
40566
|
+
style: rootStyle,
|
|
40567
|
+
children: open && box.style !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
40568
|
+
ref: box.panelRef,
|
|
40569
|
+
role: "dialog",
|
|
40570
|
+
"aria-label": t("help.title"),
|
|
40571
|
+
...box.panelProps,
|
|
40572
|
+
style: {
|
|
40573
|
+
...panelStyle,
|
|
40574
|
+
...box.style
|
|
40575
|
+
},
|
|
40576
|
+
children: [
|
|
40577
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
40578
|
+
style: panelHeaderStyle,
|
|
40579
|
+
...box.moveProps,
|
|
40580
|
+
children: [
|
|
40581
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("help.title") }),
|
|
40582
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { style: { flex: 1 } }),
|
|
40583
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
40584
|
+
type: "button",
|
|
40585
|
+
"aria-pressed": pinned,
|
|
40586
|
+
"aria-label": pinned ? t("help.unpin") : t("help.pin"),
|
|
40587
|
+
title: pinned ? t("help.unpin") : t("help.pin"),
|
|
40588
|
+
onClick: () => setPinned((current) => !current),
|
|
40589
|
+
onMouseEnter: () => setPinHovered(true),
|
|
40590
|
+
onMouseLeave: () => setPinHovered(false),
|
|
40591
|
+
style: {
|
|
40592
|
+
...iconButtonStyle,
|
|
40593
|
+
color: pinned ? "#508cff" : "CanvasText",
|
|
40594
|
+
opacity: pinned ? 1 : .55,
|
|
40595
|
+
background: pinHovered ? "rgba(127,127,127,0.16)" : "transparent"
|
|
40596
|
+
},
|
|
40597
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PinIcon, { filled: pinned })
|
|
40598
|
+
}),
|
|
40599
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
40600
|
+
type: "button",
|
|
40601
|
+
"aria-label": t("help.close"),
|
|
40602
|
+
title: t("help.close"),
|
|
40603
|
+
onClick: onClose,
|
|
40604
|
+
style: {
|
|
40605
|
+
...iconButtonStyle,
|
|
40606
|
+
fontSize: 15,
|
|
40607
|
+
lineHeight: 1
|
|
40608
|
+
},
|
|
40609
|
+
children: "×"
|
|
40610
|
+
})
|
|
40611
|
+
]
|
|
40612
|
+
}),
|
|
40613
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
40614
|
+
style: subtitleStyle,
|
|
40615
|
+
children: t("help.subtitle")
|
|
40616
|
+
}),
|
|
40617
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
40618
|
+
style: tabBarStyle,
|
|
40619
|
+
role: "tablist",
|
|
40620
|
+
"aria-label": t("help.title"),
|
|
40621
|
+
children: TABS.map((spec) => {
|
|
40622
|
+
const active = spec.id === activeTab;
|
|
40623
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
40624
|
+
type: "button",
|
|
40625
|
+
role: "tab",
|
|
40626
|
+
"aria-selected": active,
|
|
40627
|
+
className: softButtonClass(active),
|
|
40628
|
+
onClick: () => setActiveTab(spec.id),
|
|
40629
|
+
style: {
|
|
40630
|
+
...active ? SOFT_BUTTON_ACTIVE_STYLE : SOFT_BUTTON_STYLE,
|
|
40631
|
+
boxShadow: active ? `inset 0 -2px 0 #508cff` : "none",
|
|
40632
|
+
...tabButtonStyle
|
|
40633
|
+
},
|
|
40634
|
+
children: t(`help.tab.${spec.id}`)
|
|
40635
|
+
}, spec.id);
|
|
40636
|
+
})
|
|
40637
|
+
}),
|
|
40638
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
40639
|
+
style: bodyStyle,
|
|
40640
|
+
children: [
|
|
40641
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
40642
|
+
style: sectionTitleStyle,
|
|
40643
|
+
children: t(`help.${tab.id}.title`)
|
|
40644
|
+
}),
|
|
40645
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
40646
|
+
style: sectionDescStyle,
|
|
40647
|
+
children: t(`help.${tab.id}.desc`)
|
|
40648
|
+
}),
|
|
40649
|
+
Array.from({ length: tab.count }, (_, index) => index + 1).map((n) => {
|
|
40650
|
+
const key = `help.ex.${tab.id}.${n}`;
|
|
40651
|
+
const copied = copiedKey === `${tab.id}-${n}`;
|
|
40652
|
+
const hint = tab.withHint ? t(`${key}.hint`) : "";
|
|
40653
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
40654
|
+
style: exampleStyle,
|
|
40655
|
+
children: [
|
|
40656
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
40657
|
+
style: exampleHeadStyle,
|
|
40658
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
40659
|
+
style: exampleLabelStyle,
|
|
40660
|
+
children: t(`${key}.label`)
|
|
40661
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
40662
|
+
type: "button",
|
|
40663
|
+
className: "dsh-zp-soft-btn",
|
|
40664
|
+
onClick: () => copyPrompt(`${tab.id}-${n}`, t(`${key}.prompt`)),
|
|
40665
|
+
style: {
|
|
40666
|
+
...SOFT_BUTTON_STYLE,
|
|
40667
|
+
...copied ? SOFT_BUTTON_ACTIVE_STYLE : null,
|
|
40668
|
+
...copyButtonStyle,
|
|
40669
|
+
color: copied ? "#508cff" : "var(--dsw-alias-label-primary, CanvasText)"
|
|
40670
|
+
},
|
|
40671
|
+
children: copied ? t("toast.copied") : t("help.copy")
|
|
40672
|
+
})]
|
|
40673
|
+
}),
|
|
40674
|
+
hint !== "" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
40675
|
+
style: hintStyle$3,
|
|
40676
|
+
children: hint
|
|
40677
|
+
}),
|
|
40678
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
40679
|
+
style: promptStyle,
|
|
40680
|
+
children: t(`${key}.prompt`)
|
|
40681
|
+
})
|
|
40682
|
+
]
|
|
40683
|
+
}, key);
|
|
40684
|
+
}),
|
|
40685
|
+
tab.footnoteKey !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
40686
|
+
style: footnoteStyle,
|
|
40687
|
+
children: t(tab.footnoteKey)
|
|
40688
|
+
})
|
|
40689
|
+
]
|
|
40690
|
+
}),
|
|
40691
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
40692
|
+
"aria-hidden": "true",
|
|
40693
|
+
title: t("help.resize"),
|
|
40694
|
+
...box.resizeProps,
|
|
40695
|
+
style: resizeHandleStyle,
|
|
40696
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ResizeIcon, {})
|
|
40697
|
+
})
|
|
40698
|
+
]
|
|
40699
|
+
})
|
|
40700
|
+
});
|
|
40701
|
+
}
|
|
40702
|
+
function PinIcon({ filled }) {
|
|
40703
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
40704
|
+
width: "13",
|
|
40705
|
+
height: "13",
|
|
40706
|
+
viewBox: "0 0 16 16",
|
|
40707
|
+
"aria-hidden": "true",
|
|
40708
|
+
focusable: "false",
|
|
40709
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
40710
|
+
d: "M9.5 1.5 14.5 6.5 11 8l-2 4-1.5-1.5L4 13 3 12l2.5-3.5L4 7l4-2z",
|
|
40711
|
+
fill: filled ? "currentColor" : "none",
|
|
40712
|
+
stroke: "currentColor",
|
|
40713
|
+
strokeWidth: "1.2",
|
|
40714
|
+
strokeLinejoin: "round"
|
|
40715
|
+
})
|
|
40716
|
+
});
|
|
40717
|
+
}
|
|
40718
|
+
function ResizeIcon() {
|
|
40719
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
|
|
40720
|
+
width: "10",
|
|
40721
|
+
height: "10",
|
|
40722
|
+
viewBox: "0 0 10 10",
|
|
40723
|
+
"aria-hidden": "true",
|
|
40724
|
+
focusable: "false",
|
|
40725
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
40726
|
+
d: "M4.2 9 9 4.2",
|
|
40727
|
+
stroke: "currentColor",
|
|
40728
|
+
strokeWidth: "1.2",
|
|
40729
|
+
strokeLinecap: "round"
|
|
40730
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
40731
|
+
d: "M7.4 9 9 7.4",
|
|
40732
|
+
stroke: "currentColor",
|
|
40733
|
+
strokeWidth: "1.2",
|
|
40734
|
+
strokeLinecap: "round"
|
|
40735
|
+
})]
|
|
40736
|
+
});
|
|
40737
|
+
}
|
|
40738
|
+
/**
|
|
40739
|
+
* 透明根层:只负责把 zIndex 抬到聊天区 / 输入框之上;自身不画东西、不拦点击。
|
|
40740
|
+
* 层级高于兄弟浮层的 300,低于截图定格 400 与宿主对话框(≥1000)。
|
|
40741
|
+
*/
|
|
40742
|
+
const rootStyle = {
|
|
40743
|
+
position: "absolute",
|
|
40744
|
+
inset: 0,
|
|
40745
|
+
zIndex: 320,
|
|
40746
|
+
pointerEvents: "none"
|
|
40747
|
+
};
|
|
40748
|
+
const panelStyle = {
|
|
40749
|
+
position: "fixed",
|
|
40750
|
+
pointerEvents: "auto",
|
|
40751
|
+
display: "flex",
|
|
40752
|
+
flexDirection: "column",
|
|
40753
|
+
padding: "10px 10px 8px",
|
|
40754
|
+
borderRadius: 8,
|
|
40755
|
+
border: "1px solid rgba(127,127,127,0.32)",
|
|
40756
|
+
background: "Canvas",
|
|
40757
|
+
color: "CanvasText",
|
|
40758
|
+
boxShadow: "0 10px 30px rgba(0,0,0,0.3)",
|
|
40759
|
+
fontSize: 12,
|
|
40760
|
+
lineHeight: 1.6,
|
|
40761
|
+
overscrollBehavior: "contain",
|
|
40762
|
+
zIndex: 320
|
|
40763
|
+
};
|
|
40764
|
+
const panelHeaderStyle = {
|
|
40765
|
+
display: "flex",
|
|
40766
|
+
alignItems: "center",
|
|
40767
|
+
gap: 6,
|
|
40768
|
+
flexShrink: 0,
|
|
40769
|
+
padding: "0 2px 8px",
|
|
40770
|
+
marginBottom: 6,
|
|
40771
|
+
borderBottom: "1px solid rgba(127,127,127,0.2)",
|
|
40772
|
+
fontWeight: 700,
|
|
40773
|
+
fontSize: 13,
|
|
40774
|
+
color: ACCENT,
|
|
40775
|
+
cursor: "move",
|
|
40776
|
+
userSelect: "none",
|
|
40777
|
+
touchAction: "none"
|
|
40778
|
+
};
|
|
40779
|
+
const iconButtonStyle = {
|
|
40780
|
+
display: "inline-flex",
|
|
40781
|
+
alignItems: "center",
|
|
40782
|
+
justifyContent: "center",
|
|
40783
|
+
flexShrink: 0,
|
|
40784
|
+
width: 20,
|
|
40785
|
+
height: 20,
|
|
40786
|
+
padding: 0,
|
|
40787
|
+
borderRadius: 4,
|
|
40788
|
+
border: "none",
|
|
40789
|
+
cursor: "pointer",
|
|
40790
|
+
transition: "background-color 120ms ease"
|
|
40791
|
+
};
|
|
40792
|
+
const subtitleStyle = {
|
|
40793
|
+
flexShrink: 0,
|
|
40794
|
+
padding: "0 2px 8px",
|
|
40795
|
+
fontSize: 11.5,
|
|
40796
|
+
opacity: .7
|
|
40797
|
+
};
|
|
40798
|
+
const tabBarStyle = {
|
|
40799
|
+
display: "flex",
|
|
40800
|
+
flexWrap: "wrap",
|
|
40801
|
+
gap: 4,
|
|
40802
|
+
flexShrink: 0,
|
|
40803
|
+
padding: "0 2px 8px"
|
|
40804
|
+
};
|
|
40805
|
+
const tabButtonStyle = {
|
|
40806
|
+
borderRadius: 6,
|
|
40807
|
+
padding: "4px 8px",
|
|
40808
|
+
fontSize: 11.5,
|
|
40809
|
+
lineHeight: "18px",
|
|
40810
|
+
whiteSpace: "nowrap",
|
|
40811
|
+
cursor: "pointer"
|
|
40812
|
+
};
|
|
40813
|
+
const bodyStyle = {
|
|
40814
|
+
flex: 1,
|
|
40815
|
+
minHeight: 0,
|
|
40816
|
+
overflow: "auto",
|
|
40817
|
+
overscrollBehavior: "contain",
|
|
40818
|
+
padding: "0 4px 16px"
|
|
40819
|
+
};
|
|
40820
|
+
const sectionTitleStyle = {
|
|
40821
|
+
fontSize: 12.5,
|
|
40822
|
+
fontWeight: 700,
|
|
40823
|
+
color: ACCENT,
|
|
40824
|
+
margin: "2px 0 4px"
|
|
40825
|
+
};
|
|
40826
|
+
const sectionDescStyle = {
|
|
40827
|
+
margin: "0 0 10px",
|
|
40828
|
+
fontSize: 11.5,
|
|
40829
|
+
opacity: .78
|
|
40830
|
+
};
|
|
40831
|
+
const exampleStyle = {
|
|
40832
|
+
marginBottom: 9,
|
|
40833
|
+
padding: "7px 8px",
|
|
40834
|
+
borderRadius: 6,
|
|
40835
|
+
border: "1px solid rgba(127,127,127,0.18)",
|
|
40836
|
+
background: "rgba(127,127,127,0.06)"
|
|
40837
|
+
};
|
|
40838
|
+
const exampleHeadStyle = {
|
|
40839
|
+
display: "flex",
|
|
40840
|
+
alignItems: "center",
|
|
40841
|
+
gap: 8,
|
|
40842
|
+
marginBottom: 5
|
|
40843
|
+
};
|
|
40844
|
+
const exampleLabelStyle = {
|
|
40845
|
+
flex: 1,
|
|
40846
|
+
minWidth: 0,
|
|
40847
|
+
fontSize: 12,
|
|
40848
|
+
fontWeight: 600
|
|
40849
|
+
};
|
|
40850
|
+
const copyButtonStyle = {
|
|
40851
|
+
padding: "0 7px",
|
|
40852
|
+
fontSize: 11,
|
|
40853
|
+
lineHeight: "18px",
|
|
40854
|
+
borderRadius: 5,
|
|
40855
|
+
cursor: "pointer",
|
|
40856
|
+
whiteSpace: "nowrap"
|
|
40857
|
+
};
|
|
40858
|
+
const hintStyle$3 = {
|
|
40859
|
+
fontSize: 11,
|
|
40860
|
+
opacity: .62,
|
|
40861
|
+
marginBottom: 5
|
|
40862
|
+
};
|
|
40863
|
+
const promptStyle = {
|
|
40864
|
+
fontFamily: "ui-monospace, SFMono-Regular, Menlo, monospace",
|
|
40865
|
+
fontSize: 11.5,
|
|
40866
|
+
lineHeight: 1.6,
|
|
40867
|
+
background: "rgba(127,127,127,0.10)",
|
|
40868
|
+
border: "1px solid rgba(127,127,127,0.22)",
|
|
40869
|
+
borderRadius: 6,
|
|
40870
|
+
padding: "6px 8px",
|
|
40871
|
+
whiteSpace: "pre-wrap",
|
|
40872
|
+
wordBreak: "break-word",
|
|
40873
|
+
color: "CanvasText",
|
|
40874
|
+
userSelect: "text"
|
|
40875
|
+
};
|
|
40876
|
+
const footnoteStyle = {
|
|
40877
|
+
margin: "10px 0 0",
|
|
40878
|
+
padding: "7px 8px",
|
|
40879
|
+
fontSize: 11,
|
|
40880
|
+
lineHeight: 1.6,
|
|
40881
|
+
opacity: .72,
|
|
40882
|
+
borderLeft: `2px solid ${ACCENT}`,
|
|
40883
|
+
background: "rgba(80,140,255,0.06)",
|
|
40884
|
+
borderRadius: "0 4px 4px 0"
|
|
40885
|
+
};
|
|
40886
|
+
const resizeHandleStyle = {
|
|
40887
|
+
position: "absolute",
|
|
40888
|
+
right: 2,
|
|
40889
|
+
bottom: 2,
|
|
40890
|
+
display: "flex",
|
|
40891
|
+
alignItems: "center",
|
|
40892
|
+
justifyContent: "center",
|
|
40893
|
+
width: 16,
|
|
40894
|
+
height: 16,
|
|
40895
|
+
color: "rgba(127,127,127,0.7)",
|
|
40896
|
+
cursor: "nwse-resize",
|
|
40897
|
+
touchAction: "none",
|
|
40898
|
+
userSelect: "none"
|
|
40899
|
+
};
|
|
40900
|
+
//#endregion
|
|
40187
40901
|
//#region src/client/readState.tsx
|
|
40188
40902
|
/** 已读条目标题的淡化程度:留一点提示,又不至于看成禁用态。 */
|
|
40189
40903
|
const READ_TITLE_OPACITY = .75;
|
|
@@ -40420,14 +41134,22 @@ const itemMetaYearStyle = {
|
|
|
40420
41134
|
flex: "0 0 auto",
|
|
40421
41135
|
opacity: .85
|
|
40422
41136
|
};
|
|
40423
|
-
/**
|
|
40424
|
-
const
|
|
41137
|
+
/** 第二行末尾的子项统计:一组「类型图标 + 数字」,靠右且不参与作者截断。 */
|
|
41138
|
+
const itemMetaChildKindsStyle = {
|
|
40425
41139
|
display: "inline-flex",
|
|
40426
41140
|
alignItems: "center",
|
|
40427
|
-
gap:
|
|
41141
|
+
gap: 6,
|
|
40428
41142
|
flex: "0 0 auto",
|
|
41143
|
+
marginLeft: "auto",
|
|
40429
41144
|
opacity: .85
|
|
40430
41145
|
};
|
|
41146
|
+
/** 单种类型的「图标 + 个数」。 */
|
|
41147
|
+
const itemMetaChildKindStyle = {
|
|
41148
|
+
display: "inline-flex",
|
|
41149
|
+
alignItems: "center",
|
|
41150
|
+
gap: 2,
|
|
41151
|
+
flex: "0 0 auto"
|
|
41152
|
+
};
|
|
40431
41153
|
const itemMetaTextStyle = {
|
|
40432
41154
|
flex: "1 1 auto",
|
|
40433
41155
|
minWidth: 0,
|
|
@@ -40520,6 +41242,14 @@ const sortButtonStyle = {
|
|
|
40520
41242
|
};
|
|
40521
41243
|
/** 排序生效时的图标颜色(与列表选中态同一支蓝)。 */
|
|
40522
41244
|
const SORT_ACTIVE_COLOR = "#508cff";
|
|
41245
|
+
/** 副标题统计的固定顺序:先看得到 PDF / 快照,再看笔记与其余文件。 */
|
|
41246
|
+
const CHILD_KIND_ORDER = [
|
|
41247
|
+
"pdf",
|
|
41248
|
+
"snapshot",
|
|
41249
|
+
"webpage",
|
|
41250
|
+
"note",
|
|
41251
|
+
"file"
|
|
41252
|
+
];
|
|
40523
41253
|
/**
|
|
40524
41254
|
* 排序图标:三条长短不一的横线 + 右侧方向箭头。
|
|
40525
41255
|
*
|
|
@@ -40564,22 +41294,6 @@ function DisclosureIcon({ open }) {
|
|
|
40564
41294
|
})
|
|
40565
41295
|
});
|
|
40566
41296
|
}
|
|
40567
|
-
/** 第二行附件数前的纸夹。 */
|
|
40568
|
-
function PaperclipIcon() {
|
|
40569
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
40570
|
-
width: 10,
|
|
40571
|
-
height: 10,
|
|
40572
|
-
viewBox: "0 0 16 16",
|
|
40573
|
-
fill: "none",
|
|
40574
|
-
stroke: "currentColor",
|
|
40575
|
-
strokeWidth: 1.4,
|
|
40576
|
-
strokeLinecap: "round",
|
|
40577
|
-
strokeLinejoin: "round",
|
|
40578
|
-
"aria-hidden": true,
|
|
40579
|
-
focusable: "false",
|
|
40580
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M10.4 4.2 6 8.6a1.8 1.8 0 0 0 2.5 2.5l4.4-4.4a3 3 0 0 0-4.2-4.2L4.3 6.9a4.2 4.2 0 0 0 5.9 5.9l1.1-1.1" })
|
|
40581
|
-
});
|
|
40582
|
-
}
|
|
40583
41297
|
/** 排序按钮的提示文案随状态变,点了知道下一步会变成什么。 */
|
|
40584
41298
|
function sortHint(t, sort) {
|
|
40585
41299
|
if (sort === "asc") return t("list.sortAsc");
|
|
@@ -40613,8 +41327,12 @@ function ItemRow({ t, item, selected, onSelect, onOpen, onInsert }) {
|
|
|
40613
41327
|
const [expanded, setExpanded] = (0, react.useState)(false);
|
|
40614
41328
|
const read = isRead(item);
|
|
40615
41329
|
const typeLabel = itemTypeLabel(t, item.itemType);
|
|
40616
|
-
const
|
|
40617
|
-
const
|
|
41330
|
+
const children = item.attachments;
|
|
41331
|
+
const hasChildren = children.length > 0;
|
|
41332
|
+
const kindCounts = /* @__PURE__ */ new Map();
|
|
41333
|
+
for (const child of children) kindCounts.set(child.kind, (kindCounts.get(child.kind) ?? 0) + 1);
|
|
41334
|
+
const shownKinds = CHILD_KIND_ORDER.filter((kind) => kindCounts.has(kind));
|
|
41335
|
+
const countTitle = shownKinds.map((kind) => `${childKindLabel(t, kind)} ${kindCounts.get(kind)}`).join(" · ");
|
|
40618
41336
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
40619
41337
|
className: "dsh-zotero-item-shell",
|
|
40620
41338
|
style: selected ? {
|
|
@@ -40645,7 +41363,7 @@ function ItemRow({ t, item, selected, onSelect, onOpen, onInsert }) {
|
|
|
40645
41363
|
},
|
|
40646
41364
|
style: itemRowStyle,
|
|
40647
41365
|
children: [
|
|
40648
|
-
|
|
41366
|
+
hasChildren ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
40649
41367
|
type: "button",
|
|
40650
41368
|
className: "dsh-zotero-disclosure",
|
|
40651
41369
|
"aria-expanded": expanded,
|
|
@@ -40664,7 +41382,11 @@ function ItemRow({ t, item, selected, onSelect, onOpen, onInsert }) {
|
|
|
40664
41382
|
}),
|
|
40665
41383
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
40666
41384
|
style: itemIconStyle,
|
|
40667
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
41385
|
+
children: item.itemType === "attachment" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ChildKindIcon, {
|
|
41386
|
+
kind: item.kind,
|
|
41387
|
+
read,
|
|
41388
|
+
size: 22
|
|
41389
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ItemTypeIcon, {
|
|
40668
41390
|
itemType: item.itemType,
|
|
40669
41391
|
read
|
|
40670
41392
|
})
|
|
@@ -40677,7 +41399,7 @@ function ItemRow({ t, item, selected, onSelect, onOpen, onInsert }) {
|
|
|
40677
41399
|
...readTitleStyle(read)
|
|
40678
41400
|
},
|
|
40679
41401
|
children: item.title
|
|
40680
|
-
}), (typeLabel !== "" || item.year !== "" || item.creators !== "" ||
|
|
41402
|
+
}), (typeLabel !== "" || item.year !== "" || item.creators !== "" || hasChildren) && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
40681
41403
|
style: itemMetaStyle,
|
|
40682
41404
|
children: [
|
|
40683
41405
|
typeLabel !== "" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
@@ -40692,34 +41414,41 @@ function ItemRow({ t, item, selected, onSelect, onOpen, onInsert }) {
|
|
|
40692
41414
|
style: itemMetaTextStyle,
|
|
40693
41415
|
children: item.creators
|
|
40694
41416
|
}),
|
|
40695
|
-
|
|
40696
|
-
style:
|
|
40697
|
-
title:
|
|
40698
|
-
children:
|
|
41417
|
+
hasChildren && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
41418
|
+
style: itemMetaChildKindsStyle,
|
|
41419
|
+
title: countTitle,
|
|
41420
|
+
children: shownKinds.map((kind) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
41421
|
+
style: itemMetaChildKindStyle,
|
|
41422
|
+
title: childKindLabel(t, kind),
|
|
41423
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ChildKindIcon, {
|
|
41424
|
+
kind,
|
|
41425
|
+
size: 12
|
|
41426
|
+
}), kindCounts.get(kind)]
|
|
41427
|
+
}, kind))
|
|
40699
41428
|
})
|
|
40700
41429
|
]
|
|
40701
41430
|
})]
|
|
40702
41431
|
})
|
|
40703
41432
|
]
|
|
40704
41433
|
})
|
|
40705
|
-
}), expanded &&
|
|
41434
|
+
}), expanded && hasChildren && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
40706
41435
|
style: childListStyle,
|
|
40707
|
-
children:
|
|
41436
|
+
children: children.map((child) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
40708
41437
|
className: "dsh-zotero-child-row",
|
|
40709
|
-
title: `${
|
|
40710
|
-
onClick: () => onOpen(
|
|
41438
|
+
title: `${child.title}\n${t("list.openAttachment")}`,
|
|
41439
|
+
onClick: () => onOpen(child.key, child.title),
|
|
40711
41440
|
style: childRowStyle,
|
|
40712
41441
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
40713
41442
|
style: childIconStyle,
|
|
40714
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
40715
|
-
|
|
41443
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ChildKindIcon, {
|
|
41444
|
+
kind: child.kind,
|
|
40716
41445
|
size: 15
|
|
40717
41446
|
})
|
|
40718
41447
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
40719
41448
|
style: childTitleStyle,
|
|
40720
|
-
children:
|
|
41449
|
+
children: child.title
|
|
40721
41450
|
})]
|
|
40722
|
-
},
|
|
41451
|
+
}, child.key))
|
|
40723
41452
|
})]
|
|
40724
41453
|
});
|
|
40725
41454
|
}
|
|
@@ -41297,8 +42026,11 @@ function StatusDot({ ok, label }) {
|
|
|
41297
42026
|
} }), label]
|
|
41298
42027
|
});
|
|
41299
42028
|
}
|
|
42029
|
+
function errorMessage(error) {
|
|
42030
|
+
return error instanceof Error ? error.message : String(error);
|
|
42031
|
+
}
|
|
41300
42032
|
function ZoteroPane({ t, inputActions, sessions, sessionId, onOpenItem }) {
|
|
41301
|
-
const { health, libraryName, collections, treeError, treeLoading, selectedCollection, query, items, itemsTotal, itemsLoading, itemsError, tags, tagsLoading, tagsError, treeQuery, recentCount, tagQuery, selectedTags, tagMode, tagUsage, tagUsageLoading, sort, selectedItemKeys } = usePaneState();
|
|
42033
|
+
const { health, libraryName, collections, treeError, treeLoading, selectedCollection, query, items, itemsTotal, itemsLoading, itemsError, tags, tagsLoading, tagsError, treeQuery, recentCount, virtualCounts, tagQuery, selectedTags, tagMode, tagUsage, tagUsageLoading, sort, selectedItemKeys } = usePaneState();
|
|
41302
42034
|
(0, react.useEffect)(() => {
|
|
41303
42035
|
loadTree();
|
|
41304
42036
|
}, []);
|
|
@@ -41308,10 +42040,27 @@ function ZoteroPane({ t, inputActions, sessions, sessionId, onOpenItem }) {
|
|
|
41308
42040
|
*/
|
|
41309
42041
|
const recent = isRecentSelection(selectedCollection);
|
|
41310
42042
|
const insertion = useInsertion(t, sessions, sessionId, inputActions);
|
|
42043
|
+
/**
|
|
42044
|
+
* 跳回 Zotero 主窗口:真实分类带 key 跳到该分类(目录树 + 列表),
|
|
42045
|
+
* 文库根与「最近阅读」等虚拟分类没有 select URL,只唤起主窗口。
|
|
42046
|
+
*/
|
|
42047
|
+
function openCurrentInZotero() {
|
|
42048
|
+
const collection = selectedCollection;
|
|
42049
|
+
const key = collection !== null && collection.key !== "__library__" && collection.scope === void 0 ? collection.key : null;
|
|
42050
|
+
openInZotero(key === null ? { kind: "library" } : {
|
|
42051
|
+
kind: "collection",
|
|
42052
|
+
key
|
|
42053
|
+
}).catch((error) => {
|
|
42054
|
+
showToast(tpl(t("viewer.openFailed"), { message: errorMessage(error) }));
|
|
42055
|
+
});
|
|
42056
|
+
}
|
|
41311
42057
|
const [treeWidth, setTreeWidth] = (0, react.useState)(readTreeWidth);
|
|
41312
42058
|
const [splitHover, setSplitHover] = (0, react.useState)(false);
|
|
41313
42059
|
const bodyRef = (0, react.useRef)(null);
|
|
41314
42060
|
const dragRef = (0, react.useRef)(null);
|
|
42061
|
+
/** 「使用帮助」浮窗的开合;包裹触发按钮的 span 作为 useDismiss 的 extraRef。 */
|
|
42062
|
+
const [helpOpen, setHelpOpen] = (0, react.useState)(false);
|
|
42063
|
+
const helpTriggerRef = (0, react.useRef)(null);
|
|
41315
42064
|
/** 左栏宽度夹在 [TREE_WIDTH_MIN, 容器宽 - DETAIL_WIDTH_MIN] 之间。 */
|
|
41316
42065
|
function clampTreeWidth(next) {
|
|
41317
42066
|
const total = bodyRef.current?.clientWidth ?? 0;
|
|
@@ -41369,11 +42118,47 @@ function ZoteroPane({ t, inputActions, sessions, sessionId, onOpenItem }) {
|
|
|
41369
42118
|
label: t(health?.mcp.running === true ? "status.mcpOn" : "status.mcpOff")
|
|
41370
42119
|
}),
|
|
41371
42120
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { style: { flex: 1 } }),
|
|
42121
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
42122
|
+
ref: helpTriggerRef,
|
|
42123
|
+
style: {
|
|
42124
|
+
display: "inline-flex",
|
|
42125
|
+
flexShrink: 0
|
|
42126
|
+
},
|
|
42127
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Button, {
|
|
42128
|
+
variant: "primary",
|
|
42129
|
+
size: "sm",
|
|
42130
|
+
className: HELP_BUTTON_CLASS,
|
|
42131
|
+
style: HELP_PRIMARY_STYLE,
|
|
42132
|
+
title: t("help.buttonTitle"),
|
|
42133
|
+
"aria-expanded": helpOpen,
|
|
42134
|
+
onClick: () => setHelpOpen((open) => !open),
|
|
42135
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
42136
|
+
"aria-hidden": "true",
|
|
42137
|
+
style: {
|
|
42138
|
+
fontWeight: 700,
|
|
42139
|
+
marginRight: 4
|
|
42140
|
+
},
|
|
42141
|
+
children: "?"
|
|
42142
|
+
}), t("help.button")]
|
|
42143
|
+
})
|
|
42144
|
+
}),
|
|
41372
42145
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button, {
|
|
41373
42146
|
variant: "ghost",
|
|
41374
42147
|
size: "sm",
|
|
41375
42148
|
onClick: () => void loadTree(true),
|
|
41376
42149
|
children: t("action.refresh")
|
|
42150
|
+
}),
|
|
42151
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Button, {
|
|
42152
|
+
variant: "ghost",
|
|
42153
|
+
size: "sm",
|
|
42154
|
+
onClick: openCurrentInZotero,
|
|
42155
|
+
title: t("viewer.openInZotero"),
|
|
42156
|
+
style: {
|
|
42157
|
+
display: "inline-flex",
|
|
42158
|
+
alignItems: "center",
|
|
42159
|
+
gap: 5
|
|
42160
|
+
},
|
|
42161
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(OpenInZoteroIcon, { size: 12 }), t("viewer.openInZoteroShort")]
|
|
41377
42162
|
})
|
|
41378
42163
|
]
|
|
41379
42164
|
}),
|
|
@@ -41428,6 +42213,7 @@ function ZoteroPane({ t, inputActions, sessions, sessionId, onOpenItem }) {
|
|
|
41428
42213
|
treeQuery,
|
|
41429
42214
|
selectedCollectionKey: selectedCollection?.key ?? null,
|
|
41430
42215
|
recentCount,
|
|
42216
|
+
virtualCounts,
|
|
41431
42217
|
onSelectCollection: selectCollection,
|
|
41432
42218
|
onInsertCollection: insertion.insertCollection
|
|
41433
42219
|
})
|
|
@@ -41513,6 +42299,13 @@ function ZoteroPane({ t, inputActions, sessions, sessionId, onOpenItem }) {
|
|
|
41513
42299
|
})
|
|
41514
42300
|
]
|
|
41515
42301
|
}),
|
|
42302
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(HelpWindow, {
|
|
42303
|
+
t,
|
|
42304
|
+
open: helpOpen,
|
|
42305
|
+
anchorRef: bodyRef,
|
|
42306
|
+
triggerRef: helpTriggerRef,
|
|
42307
|
+
onClose: () => setHelpOpen(false)
|
|
42308
|
+
}),
|
|
41516
42309
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Toast, {})
|
|
41517
42310
|
]
|
|
41518
42311
|
});
|