dsh-plugin-zotero 0.5.0 → 0.5.2
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 +671 -294
- package/lib/host/router.js +5 -0
- package/lib/zotero/client.d.ts +3 -0
- package/lib/zotero/client.js +10 -0
- package/package.json +1 -1
package/client/client.js
CHANGED
|
@@ -338,6 +338,9 @@ const dicts = {
|
|
|
338
338
|
"list.emptyFiltered": "没有符合条件的条目",
|
|
339
339
|
"list.loadFailed": "条目列表加载失败:{message}",
|
|
340
340
|
"list.loadMore": "加载更多",
|
|
341
|
+
"list.sortNone": "按标题排序(当前为 Zotero 原始顺序)",
|
|
342
|
+
"list.sortAsc": "标题正序 A→Z(再点切换为倒序)",
|
|
343
|
+
"list.sortDesc": "标题倒序 Z→A(再点恢复原始顺序)",
|
|
341
344
|
"tags.title": "标签",
|
|
342
345
|
"tags.filterPlaceholder": "筛选标签名称",
|
|
343
346
|
"tags.empty": "这个文库还没有标签",
|
|
@@ -411,8 +414,8 @@ const dicts = {
|
|
|
411
414
|
"toast.insertedItems": "已把 {n} 条加入会话草稿",
|
|
412
415
|
"toast.copied": "已复制",
|
|
413
416
|
"toast.copyFailed": "复制失败",
|
|
414
|
-
"settings.nav": "Zotero",
|
|
415
|
-
"settings.hint": "这些参数决定面板与模型工具如何连上 Zotero
|
|
417
|
+
"settings.nav": "Zotero 插件",
|
|
418
|
+
"settings.hint": "这些参数决定面板与模型工具如何连上 Zotero;改完自动保存、即时生效,无需重启。",
|
|
416
419
|
"group.api": "API 设置",
|
|
417
420
|
"group.mcp": "MCP 设置",
|
|
418
421
|
"tools.title": "MCP 工具",
|
|
@@ -491,7 +494,7 @@ const dicts = {
|
|
|
491
494
|
"write.reauthorize": "重新授权",
|
|
492
495
|
"write.authorizeHint": "Zotero 会弹出一次确认框,选「始终允许」后长期有效",
|
|
493
496
|
"write.pending": "等待 Zotero 弹窗…",
|
|
494
|
-
"write.needSave": "
|
|
497
|
+
"write.needSave": "请先打开上面的开关,再授权",
|
|
495
498
|
"write.granted": "已取得写权限并保存到本机:以后重启不用再授权。",
|
|
496
499
|
"write.grantedOnce": "这次拿到的是一次性授权:只对下一次写入有效,重启后还要再授权。",
|
|
497
500
|
"write.alwaysAllow": "弹窗里选「始终允许」:授权会保存到本机,点一次长期有效;选「允许」只用一次。",
|
|
@@ -514,9 +517,8 @@ const dicts = {
|
|
|
514
517
|
"field.defaultLimitHint": "面板条目列表默认拉取条数,默认 50",
|
|
515
518
|
"form.unavailable": "该插件当前未加载,暂时无法配置。",
|
|
516
519
|
"form.readOnly": "本部署的设置为只读。",
|
|
517
|
-
"form.
|
|
518
|
-
"form.
|
|
519
|
-
"form.saving": "保存中…",
|
|
520
|
+
"form.autosaving": "正在自动保存…",
|
|
521
|
+
"form.autosaveFailed": "自动保存失败:这些值还没写进配置,改动任意字段会再试一次。",
|
|
520
522
|
"form.overridden": "已覆盖",
|
|
521
523
|
"form.reset": "恢复默认",
|
|
522
524
|
"form.invalidNumber": "请填数字;留空表示使用默认值。",
|
|
@@ -660,6 +662,9 @@ const dicts = {
|
|
|
660
662
|
"list.emptyFiltered": "No items match the filters",
|
|
661
663
|
"list.loadFailed": "Failed to load items: {message}",
|
|
662
664
|
"list.loadMore": "Load more",
|
|
665
|
+
"list.sortNone": "Sort by title (currently Zotero default order)",
|
|
666
|
+
"list.sortAsc": "Title A→Z (click again for Z→A)",
|
|
667
|
+
"list.sortDesc": "Title Z→A (click again for default order)",
|
|
663
668
|
"tags.title": "Tags",
|
|
664
669
|
"tags.filterPlaceholder": "Filter tag names",
|
|
665
670
|
"tags.empty": "This library has no tags yet",
|
|
@@ -733,8 +738,8 @@ const dicts = {
|
|
|
733
738
|
"toast.insertedItems": "Added {n} to the conversation draft",
|
|
734
739
|
"toast.copied": "Copied",
|
|
735
740
|
"toast.copyFailed": "Copy failed",
|
|
736
|
-
"settings.nav": "Zotero",
|
|
737
|
-
"settings.hint": "These parameters decide how the panel and the model tools reach Zotero;
|
|
741
|
+
"settings.nav": "Zotero Plugin",
|
|
742
|
+
"settings.hint": "These parameters decide how the panel and the model tools reach Zotero; edits save automatically and take effect immediately, no restart needed.",
|
|
738
743
|
"group.api": "API settings",
|
|
739
744
|
"group.mcp": "MCP settings",
|
|
740
745
|
"tools.title": "MCP tools",
|
|
@@ -813,7 +818,7 @@ const dicts = {
|
|
|
813
818
|
"write.reauthorize": "Authorize again",
|
|
814
819
|
"write.authorizeHint": "Zotero asks once; pick \"Always allow\" to keep the grant",
|
|
815
820
|
"write.pending": "Waiting for the Zotero dialog…",
|
|
816
|
-
"write.needSave": "Turn the switch on
|
|
821
|
+
"write.needSave": "Turn the switch on first, then authorize",
|
|
817
822
|
"write.granted": "Write access granted and saved on this machine: no re-authorizing after restarts.",
|
|
818
823
|
"write.grantedOnce": "That grant works once: only the next write is covered, and a restart needs authorizing again.",
|
|
819
824
|
"write.alwaysAllow": "Pick \"Always allow\": the grant is saved on this machine and covers future runs. \"Allow\" only covers one write.",
|
|
@@ -836,9 +841,8 @@ const dicts = {
|
|
|
836
841
|
"field.defaultLimitHint": "Default number of items a page loads, default 50",
|
|
837
842
|
"form.unavailable": "This plugin is not loaded, so it cannot be configured right now.",
|
|
838
843
|
"form.readOnly": "This deployment stores settings read-only.",
|
|
839
|
-
"form.
|
|
840
|
-
"form.
|
|
841
|
-
"form.saving": "Saving…",
|
|
844
|
+
"form.autosaving": "Saving automatically…",
|
|
845
|
+
"form.autosaveFailed": "Auto-save failed: these values are not in the config yet. Edit any field to retry.",
|
|
842
846
|
"form.overridden": "Overridden",
|
|
843
847
|
"form.reset": "Reset to default",
|
|
844
848
|
"form.invalidNumber": "Enter a number; leave blank to use the default.",
|
|
@@ -927,8 +931,18 @@ const SEARCH_DEBOUNCE_MS = 250;
|
|
|
927
931
|
const ITEMS_PAGE_SIZE = 50;
|
|
928
932
|
/** 提示条停留时长。 */
|
|
929
933
|
const TOAST_MS = 3e3;
|
|
934
|
+
/** 列表排序的存储键(localStorage,跨会话与重启都记住)。 */
|
|
935
|
+
const SORT_KEY = "dsh-plugin-zotero.itemSort";
|
|
930
936
|
/** 文库根节点的 id(只存在于客户端,不对应任何 Zotero 分类)。 */
|
|
931
937
|
const TREE_ROOT_ID = "__library__";
|
|
938
|
+
function readSort() {
|
|
939
|
+
try {
|
|
940
|
+
const value = window.localStorage.getItem(SORT_KEY);
|
|
941
|
+
return value === "asc" || value === "desc" ? value : "none";
|
|
942
|
+
} catch {
|
|
943
|
+
return "none";
|
|
944
|
+
}
|
|
945
|
+
}
|
|
932
946
|
function initialState() {
|
|
933
947
|
return {
|
|
934
948
|
health: null,
|
|
@@ -945,6 +959,7 @@ function initialState() {
|
|
|
945
959
|
itemsLoading: false,
|
|
946
960
|
itemsError: null,
|
|
947
961
|
selectedItemKeys: /* @__PURE__ */ new Set(),
|
|
962
|
+
sort: readSort(),
|
|
948
963
|
tags: null,
|
|
949
964
|
tagsLoading: false,
|
|
950
965
|
tagsError: null,
|
|
@@ -1192,6 +1207,8 @@ function reloadItems(options) {
|
|
|
1192
1207
|
q: state.query.trim(),
|
|
1193
1208
|
tags: tags.length === 0 ? void 0 : tags,
|
|
1194
1209
|
tagMode: tags.length === 0 ? void 0 : state.tagMode,
|
|
1210
|
+
sort: state.sort === "none" ? void 0 : "title",
|
|
1211
|
+
direction: state.sort === "none" ? void 0 : state.sort,
|
|
1195
1212
|
limit: ITEMS_PAGE_SIZE,
|
|
1196
1213
|
offset
|
|
1197
1214
|
}, controller.signal).then((data) => {
|
|
@@ -1218,6 +1235,19 @@ function loadMoreItems() {
|
|
|
1218
1235
|
append: true
|
|
1219
1236
|
});
|
|
1220
1237
|
}
|
|
1238
|
+
/**
|
|
1239
|
+
* 切换标题排序:原始顺序 → 正序 → 倒序 → 原始顺序。
|
|
1240
|
+
*
|
|
1241
|
+
* 状态写进 localStorage:所有会话共用同一块面板,重启后也保持上次的选择。
|
|
1242
|
+
*/
|
|
1243
|
+
function cycleItemSort() {
|
|
1244
|
+
const next = state.sort === "none" ? "asc" : state.sort === "asc" ? "desc" : "none";
|
|
1245
|
+
patch$1({ sort: next });
|
|
1246
|
+
try {
|
|
1247
|
+
window.localStorage.setItem(SORT_KEY, next);
|
|
1248
|
+
} catch {}
|
|
1249
|
+
reloadItems({ reset: true });
|
|
1250
|
+
}
|
|
1221
1251
|
function retryItems() {
|
|
1222
1252
|
reloadItems({ reset: true });
|
|
1223
1253
|
}
|
|
@@ -1844,10 +1874,15 @@ function insertChip(sessions, sessionId, reference, span) {
|
|
|
1844
1874
|
* 设置页(浏览器半)。
|
|
1845
1875
|
*
|
|
1846
1876
|
* 把 Host 导出的 volatile `Config` 表单渲染进「设置」对话框的
|
|
1847
|
-
* `settings.section` 席位(左侧导航里独立一页「Zotero
|
|
1848
|
-
*
|
|
1877
|
+
* `settings.section` 席位(左侧导航里独立一页「Zotero 插件」)—— 表单模型照抄官方
|
|
1878
|
+
* 参考实现 `@deepseek-ai/dsh-client-ui-settings-shell` 的 `ShellCard`:
|
|
1849
1879
|
* 控制器持 `SettingsFormModel`,组件经注入的 hook 读快照。
|
|
1850
1880
|
*
|
|
1881
|
+
* **没有保存按钮**:字段改完停手 {@link AUTOSAVE_DELAY_MS} 就自动落盘(今天大家
|
|
1882
|
+
* 已经不习惯点保存),失败不自动重试、等下一次编辑;离开页面时把合法草稿立刻冲掉、
|
|
1883
|
+
* 非法草稿直接丢弃。因此这里用普通 `<div>` 容器而不是框架的 `SettingsForm`——
|
|
1884
|
+
* 后者的页脚写死了一个「保存」按钮,没有关掉的开关。
|
|
1885
|
+
*
|
|
1851
1886
|
* 顺序:**Zotero 写权限**(置顶 —— 写入开关 + 授权/重读按钮,写成显眼的操作卡)、
|
|
1852
1887
|
* **API 设置**(本地 API 与面板行为)、**MCP 设置**(集成 MCP 连接 + 工具清单)。
|
|
1853
1888
|
* 写权限放最前是因为「没点授权按钮 → 写操作全失败」是最常见的踩坑点,不能让用户
|
|
@@ -1894,6 +1929,13 @@ const MCP_FIELDS = [{
|
|
|
1894
1929
|
}];
|
|
1895
1930
|
const ALL_FIELDS = [...API_FIELDS, ...MCP_FIELDS];
|
|
1896
1931
|
/**
|
|
1932
|
+
* 自动保存的静默窗口(毫秒):最后一次改动后停手这么久才落盘。
|
|
1933
|
+
*
|
|
1934
|
+
* 太短会把「边打字边写盘」变成一串写请求(每个字符都要 patch 一次配置),
|
|
1935
|
+
* 太长又让关窗前的改动容易丢。600ms 大致等于「打完一个词、手指离开键盘」。
|
|
1936
|
+
*/
|
|
1937
|
+
const AUTOSAVE_DELAY_MS = 600;
|
|
1938
|
+
/**
|
|
1897
1939
|
* 禁用集的字段规格:表单只认文本/数字,因此把字符串数组序列化成 JSON 文本。
|
|
1898
1940
|
* 非 JSON 数组的输入视为非法,阻止保存。
|
|
1899
1941
|
*/
|
|
@@ -1945,7 +1987,7 @@ function booleanField(field) {
|
|
|
1945
1987
|
};
|
|
1946
1988
|
}
|
|
1947
1989
|
/**
|
|
1948
|
-
*
|
|
1990
|
+
* 一张卡片的暂存表单模型:改动先进暂存,由组件的防抖自动保存落盘(没有保存按钮)。
|
|
1949
1991
|
* `scope` 由 `configForms.get(ROW_ID)` 提供(本条的共享配置表单)。
|
|
1950
1992
|
*/
|
|
1951
1993
|
var ZoteroCardController = class {
|
|
@@ -2053,6 +2095,35 @@ const SECTION_HINT_STYLE = {
|
|
|
2053
2095
|
opacity: .72,
|
|
2054
2096
|
marginBottom: 10
|
|
2055
2097
|
};
|
|
2098
|
+
/**
|
|
2099
|
+
* 表单容器:等价于框架 `SettingsForm` 的 `._form_*`(`display:flex;
|
|
2100
|
+
* flex-direction:column`),只是不带那个写死的「保存」页脚。
|
|
2101
|
+
* 页脚没了就等于少了 16px 的底部留白,这里补一点,免得最后一行贴着对话框边缘。
|
|
2102
|
+
*/
|
|
2103
|
+
const FORM_STYLE = {
|
|
2104
|
+
display: "flex",
|
|
2105
|
+
flexDirection: "column",
|
|
2106
|
+
paddingBottom: 8
|
|
2107
|
+
};
|
|
2108
|
+
/** 不可用 / 只读提示,对齐框架 `._readOnly_*` 的字号与颜色。 */
|
|
2109
|
+
const NOTICE_STYLE = {
|
|
2110
|
+
margin: "0 0 12px",
|
|
2111
|
+
fontSize: 12,
|
|
2112
|
+
lineHeight: 1.5,
|
|
2113
|
+
color: "var(--dsw-alias-label-tertiary, rgba(128, 128, 128, 0.9))"
|
|
2114
|
+
};
|
|
2115
|
+
/** 自动保存的状态行(保存中 / 保存失败)。 */
|
|
2116
|
+
const SAVE_STATUS_STYLE = {
|
|
2117
|
+
margin: "0 0 8px",
|
|
2118
|
+
fontSize: 12,
|
|
2119
|
+
lineHeight: 1.5,
|
|
2120
|
+
opacity: .72
|
|
2121
|
+
};
|
|
2122
|
+
const SAVE_FAILED_STYLE = {
|
|
2123
|
+
...SAVE_STATUS_STYLE,
|
|
2124
|
+
opacity: 1,
|
|
2125
|
+
color: "var(--dsw-alias-state-error-primary, var(--dsw-alias-label-error, #b3261e))"
|
|
2126
|
+
};
|
|
2056
2127
|
const GROUP_STYLE = { marginTop: 4 };
|
|
2057
2128
|
const GROUP_HEAD_STYLE = {
|
|
2058
2129
|
fontSize: 12,
|
|
@@ -2148,6 +2219,101 @@ function ZoteroSettingsSection(props) {
|
|
|
2148
2219
|
const [authNotice, setAuthNotice] = (0, react.useState)(null);
|
|
2149
2220
|
const locked = !state.writable;
|
|
2150
2221
|
const disabledSet = readDisabled(state.disabledMcpTools.text);
|
|
2222
|
+
/**
|
|
2223
|
+
* 草稿指纹:任何字段改动都会换一个字符串。
|
|
2224
|
+
*
|
|
2225
|
+
* `dirty` 只是布尔,连着改两次仍是 `true`,靠它做 effect 依赖会让防抖计时器
|
|
2226
|
+
* 不重启(第二次改动落在第一次的旧计时器上)。指纹进依赖才能真正「最后一次改完
|
|
2227
|
+
* 再等 600ms」。
|
|
2228
|
+
*/
|
|
2229
|
+
const draftKey = [
|
|
2230
|
+
state.zoteroBaseUrl.text,
|
|
2231
|
+
state.mcpUrl.text,
|
|
2232
|
+
state.requestTimeoutMs.text,
|
|
2233
|
+
state.mcpProbeTimeoutMs.text,
|
|
2234
|
+
state.fulltextMaxBytes.text,
|
|
2235
|
+
state.defaultLimit.text,
|
|
2236
|
+
state.disabledMcpTools.text,
|
|
2237
|
+
state.writeEnabled.text
|
|
2238
|
+
].join("\0");
|
|
2239
|
+
/**
|
|
2240
|
+
* 自动保存:改完停手 {@link AUTOSAVE_DELAY_MS} 落盘。
|
|
2241
|
+
*
|
|
2242
|
+
* 三种情况明确不排队:
|
|
2243
|
+
* - `invalid`:有字段填得解析不出来(比如数字框里打了字母),存下去会写坏配置,
|
|
2244
|
+
* 字段自己会亮红提示,用户改对了自然会重新排队;
|
|
2245
|
+
* - `saving`:上一次写还在飞。等它落地后 `saving` 变 false,这条 effect 会重跑,
|
|
2246
|
+
* 仍在 dirty 就继续排 —— 所以连续快速改动不会被 `save()` 的 `saving` 早退吞掉;
|
|
2247
|
+
* - `failed`:写盘失败(被更高优先级 patch 层覆盖、网络断等)。**不自动重试**,
|
|
2248
|
+
* 否则每 600ms 打一次后端;`stage()` 会把 `failed` 清掉,用户再改一次即可重来。
|
|
2249
|
+
*/
|
|
2250
|
+
(0, react.useEffect)(() => {
|
|
2251
|
+
if (!state.dirty || state.invalid || state.saving || state.failed) return;
|
|
2252
|
+
const timer = setTimeout(() => {
|
|
2253
|
+
props.save();
|
|
2254
|
+
}, AUTOSAVE_DELAY_MS);
|
|
2255
|
+
return () => {
|
|
2256
|
+
clearTimeout(timer);
|
|
2257
|
+
};
|
|
2258
|
+
}, [
|
|
2259
|
+
draftKey,
|
|
2260
|
+
state.dirty,
|
|
2261
|
+
state.invalid,
|
|
2262
|
+
state.saving,
|
|
2263
|
+
state.failed
|
|
2264
|
+
]);
|
|
2265
|
+
/**
|
|
2266
|
+
* 一次写入落地后,重取工具清单与写权限状态。
|
|
2267
|
+
*
|
|
2268
|
+
* 这两处的「事实」在 Host 侧:保存会按新开关重建工具注册,写通道状态也要重读
|
|
2269
|
+
* 才会从「未开启」翻成「待授权」(原来靠 `onSave` 里那个 400ms 定时器猜落盘时间,
|
|
2270
|
+
* 现在 `saving` 由模型自己翻转,时机是准的)。
|
|
2271
|
+
*/
|
|
2272
|
+
const wasSaving = (0, react.useRef)(false);
|
|
2273
|
+
(0, react.useEffect)(() => {
|
|
2274
|
+
if (state.saving) {
|
|
2275
|
+
wasSaving.current = true;
|
|
2276
|
+
return;
|
|
2277
|
+
}
|
|
2278
|
+
if (!wasSaving.current) return;
|
|
2279
|
+
wasSaving.current = false;
|
|
2280
|
+
reloadTools();
|
|
2281
|
+
reloadWrite();
|
|
2282
|
+
}, [state.saving]);
|
|
2283
|
+
/**
|
|
2284
|
+
* 离开页面时处理残留草稿:合法的立刻冲掉(不然这 600ms 内的改动会悄悄丢),
|
|
2285
|
+
* 非法的直接丢弃(旧 `SettingsForm` 的 unmount 语义,避免下次打开还挂着一片红)。
|
|
2286
|
+
*
|
|
2287
|
+
* 用 ref 而不是把 effect 依赖铺开:这个 effect 只该在卸载时跑一次。
|
|
2288
|
+
*/
|
|
2289
|
+
const pendingRef = (0, react.useRef)({
|
|
2290
|
+
dirty: false,
|
|
2291
|
+
invalid: false,
|
|
2292
|
+
save: () => {},
|
|
2293
|
+
discard: () => {}
|
|
2294
|
+
});
|
|
2295
|
+
(0, react.useEffect)(() => {
|
|
2296
|
+
pendingRef.current = {
|
|
2297
|
+
dirty: state.dirty,
|
|
2298
|
+
invalid: state.invalid,
|
|
2299
|
+
save: () => {
|
|
2300
|
+
props.save();
|
|
2301
|
+
},
|
|
2302
|
+
discard: () => {
|
|
2303
|
+
props.discard();
|
|
2304
|
+
}
|
|
2305
|
+
};
|
|
2306
|
+
}, [
|
|
2307
|
+
draftKey,
|
|
2308
|
+
state.dirty,
|
|
2309
|
+
state.invalid
|
|
2310
|
+
]);
|
|
2311
|
+
(0, react.useEffect)(() => () => {
|
|
2312
|
+
const pending = pendingRef.current;
|
|
2313
|
+
if (!pending.dirty) return;
|
|
2314
|
+
if (pending.invalid) pending.discard();
|
|
2315
|
+
else pending.save();
|
|
2316
|
+
}, []);
|
|
2151
2317
|
const toggle = (name, enabled) => {
|
|
2152
2318
|
const next = new Set(disabledSet);
|
|
2153
2319
|
if (enabled) next.delete(name);
|
|
@@ -2347,28 +2513,37 @@ function ZoteroSettingsSection(props) {
|
|
|
2347
2513
|
})]
|
|
2348
2514
|
}), renderWriteBody()]
|
|
2349
2515
|
});
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2516
|
+
const renderStatus = () => {
|
|
2517
|
+
if (state.failed) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
2518
|
+
style: SAVE_FAILED_STYLE,
|
|
2519
|
+
role: "status",
|
|
2520
|
+
children: t("form.autosaveFailed")
|
|
2521
|
+
});
|
|
2522
|
+
if (state.saving) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
2523
|
+
style: SAVE_STATUS_STYLE,
|
|
2524
|
+
role: "status",
|
|
2525
|
+
children: t("form.autosaving")
|
|
2526
|
+
});
|
|
2527
|
+
return null;
|
|
2528
|
+
};
|
|
2529
|
+
if (!state.available) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
2530
|
+
style: NOTICE_STYLE,
|
|
2531
|
+
role: "status",
|
|
2532
|
+
children: t("form.unavailable")
|
|
2533
|
+
});
|
|
2534
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2535
|
+
style: FORM_STYLE,
|
|
2367
2536
|
children: [
|
|
2537
|
+
state.writable ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
2538
|
+
style: NOTICE_STYLE,
|
|
2539
|
+
role: "status",
|
|
2540
|
+
children: t("form.readOnly")
|
|
2541
|
+
}),
|
|
2368
2542
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2369
2543
|
style: SECTION_HINT_STYLE,
|
|
2370
2544
|
children: t("settings.hint")
|
|
2371
2545
|
}),
|
|
2546
|
+
renderStatus(),
|
|
2372
2547
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
|
|
2373
2548
|
style: GROUP_STYLE,
|
|
2374
2549
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h4", {
|
|
@@ -3887,6 +4062,8 @@ const noticeStyle$2 = {
|
|
|
3887
4062
|
* 左上角的悬浮信息菜单:文献信息 / 摘要 / 标注 / 笔记 / 附件 / 参考文献。
|
|
3888
4063
|
*
|
|
3889
4064
|
* 文档占满整版面,元数据类内容收进这个按钮背后的浮层,每块都可折叠。
|
|
4065
|
+
* 「加入对话」是这一行里的独立按钮(`i` 右侧),不放浮层里:它是每次读文献都要点的
|
|
4066
|
+
* 主操作,藏进菜单等于每次多两次点击。
|
|
3890
4067
|
* 浮层用系统色 `Canvas` / `CanvasText`,盖在白色 PDF 上深浅主题都能读。
|
|
3891
4068
|
* 点浮层外或按 Esc 关闭(统一走 {@link useDismiss},网页快照在 iframe 里的按下也算
|
|
3892
4069
|
* 「外」);点标注定位后也关闭,让文档重新成为焦点。
|
|
@@ -3984,159 +4161,162 @@ function InfoPanel({ t, detail, currentAttachmentKey, open, onToggle, onClose, o
|
|
|
3984
4161
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3985
4162
|
ref: rootRef,
|
|
3986
4163
|
style: rootStyle$6,
|
|
3987
|
-
children: [
|
|
3988
|
-
|
|
3989
|
-
|
|
3990
|
-
|
|
3991
|
-
|
|
3992
|
-
|
|
3993
|
-
|
|
3994
|
-
|
|
3995
|
-
|
|
3996
|
-
|
|
3997
|
-
|
|
3998
|
-
|
|
3999
|
-
|
|
4000
|
-
|
|
4001
|
-
|
|
4002
|
-
|
|
4003
|
-
|
|
4004
|
-
|
|
4005
|
-
|
|
4006
|
-
|
|
4007
|
-
|
|
4008
|
-
|
|
4009
|
-
|
|
4010
|
-
|
|
4011
|
-
|
|
4012
|
-
|
|
4013
|
-
|
|
4014
|
-
|
|
4015
|
-
|
|
4016
|
-
|
|
4017
|
-
|
|
4018
|
-
|
|
4019
|
-
|
|
4020
|
-
|
|
4021
|
-
children:
|
|
4022
|
-
style:
|
|
4023
|
-
children:
|
|
4024
|
-
|
|
4025
|
-
|
|
4026
|
-
|
|
4027
|
-
|
|
4028
|
-
|
|
4029
|
-
|
|
4030
|
-
|
|
4031
|
-
|
|
4032
|
-
|
|
4033
|
-
|
|
4034
|
-
|
|
4035
|
-
|
|
4036
|
-
children:
|
|
4037
|
-
|
|
4038
|
-
|
|
4039
|
-
|
|
4040
|
-
|
|
4041
|
-
|
|
4042
|
-
|
|
4043
|
-
|
|
4044
|
-
|
|
4045
|
-
|
|
4046
|
-
|
|
4047
|
-
|
|
4048
|
-
|
|
4049
|
-
|
|
4050
|
-
|
|
4051
|
-
|
|
4052
|
-
|
|
4053
|
-
|
|
4054
|
-
|
|
4055
|
-
|
|
4056
|
-
|
|
4057
|
-
|
|
4058
|
-
|
|
4059
|
-
|
|
4060
|
-
|
|
4061
|
-
|
|
4062
|
-
|
|
4063
|
-
|
|
4064
|
-
|
|
4065
|
-
if (!sections.notes) {
|
|
4066
|
-
setInfoSection("notes", true);
|
|
4067
|
-
setComposingNote(true);
|
|
4068
|
-
return;
|
|
4069
|
-
}
|
|
4070
|
-
setComposingNote((previous) => !previous);
|
|
4071
|
-
},
|
|
4072
|
-
title: composingNote ? t("note.cancel") : t("note.new"),
|
|
4073
|
-
"aria-label": t("note.new"),
|
|
4074
|
-
style: blockActionStyle,
|
|
4075
|
-
children: composingNote ? "×" : "+"
|
|
4076
|
-
}) : void 0,
|
|
4077
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NoteList, {
|
|
4078
|
-
t,
|
|
4079
|
-
notes,
|
|
4080
|
-
itemKey: detail.key,
|
|
4081
|
-
canWrite: detail.writeEnabled,
|
|
4082
|
-
selfNote,
|
|
4083
|
-
composing: composingNote,
|
|
4084
|
-
onComposingChange: setComposingNote,
|
|
4085
|
-
onInsert: onInsertNote,
|
|
4086
|
-
onChanged
|
|
4087
|
-
})
|
|
4088
|
-
}),
|
|
4089
|
-
detail.attachments.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Block, {
|
|
4090
|
-
label: t("detail.attachments"),
|
|
4091
|
-
hint: String(detail.attachments.length),
|
|
4092
|
-
open: sections.attachments,
|
|
4093
|
-
onToggle: () => toggle("attachments"),
|
|
4094
|
-
children: detail.attachments.map((attachment) => {
|
|
4095
|
-
const current = attachment.key === currentAttachmentKey;
|
|
4096
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
4164
|
+
children: [
|
|
4165
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
4166
|
+
type: "button",
|
|
4167
|
+
onClick: onToggle,
|
|
4168
|
+
"aria-expanded": open,
|
|
4169
|
+
"aria-label": t("detail.info"),
|
|
4170
|
+
title: t("detail.info"),
|
|
4171
|
+
style: triggerStyle$1,
|
|
4172
|
+
children: "i"
|
|
4173
|
+
}),
|
|
4174
|
+
!selfNote && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
4175
|
+
type: "button",
|
|
4176
|
+
onClick: onCite,
|
|
4177
|
+
title: t("action.insertItem"),
|
|
4178
|
+
style: citeTriggerStyle,
|
|
4179
|
+
children: t("action.insertItemShort")
|
|
4180
|
+
}),
|
|
4181
|
+
open && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
4182
|
+
role: "dialog",
|
|
4183
|
+
"aria-label": t("detail.info"),
|
|
4184
|
+
style: panelStyle$1,
|
|
4185
|
+
children: [
|
|
4186
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
4187
|
+
style: panelHeaderStyle$1,
|
|
4188
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
4189
|
+
style: panelTitleStyle,
|
|
4190
|
+
title: detail.title,
|
|
4191
|
+
children: detail.title
|
|
4192
|
+
})
|
|
4193
|
+
}),
|
|
4194
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Block, {
|
|
4195
|
+
label: t("detail.metadata"),
|
|
4196
|
+
open: sections.metadata,
|
|
4197
|
+
onToggle: () => toggle("metadata"),
|
|
4198
|
+
children: metaRows.map((row) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
4199
|
+
style: metaRowStyle,
|
|
4200
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
4201
|
+
style: metaLabelStyle,
|
|
4202
|
+
children: row.label
|
|
4203
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
4204
|
+
style: { wordBreak: "break-word" },
|
|
4205
|
+
children: row.value
|
|
4206
|
+
})]
|
|
4207
|
+
}, row.label))
|
|
4208
|
+
}),
|
|
4209
|
+
detail.abstract !== "" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Block, {
|
|
4210
|
+
label: t("detail.abstract"),
|
|
4211
|
+
open: sections.abstract,
|
|
4212
|
+
onToggle: () => toggle("abstract"),
|
|
4213
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
4214
|
+
style: paragraphStyle,
|
|
4215
|
+
children: detail.abstract
|
|
4216
|
+
})
|
|
4217
|
+
}),
|
|
4218
|
+
detail.annotations.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Block, {
|
|
4219
|
+
label: t("detail.annotations"),
|
|
4220
|
+
hint: String(detail.annotations.length),
|
|
4221
|
+
open: sections.annotations,
|
|
4222
|
+
onToggle: () => toggle("annotations"),
|
|
4223
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AnnotationList, {
|
|
4224
|
+
t,
|
|
4225
|
+
annotations: detail.annotations,
|
|
4226
|
+
hasFulltext: detail.fulltext !== null,
|
|
4227
|
+
truncated: detail.fulltext?.truncated === true,
|
|
4228
|
+
filter: annotationFilter,
|
|
4229
|
+
canWrite: detail.writeEnabled,
|
|
4230
|
+
onFilterChange: onAnnotationFilterChange,
|
|
4231
|
+
onLocate: onLocateAnnotation,
|
|
4232
|
+
onInsert: onInsertAnnotation,
|
|
4233
|
+
onChanged
|
|
4234
|
+
})
|
|
4235
|
+
}),
|
|
4236
|
+
(notes.length > 0 || detail.writeEnabled && !selfNote) && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Block, {
|
|
4237
|
+
label: t("detail.notes"),
|
|
4238
|
+
hint: String(notes.length),
|
|
4239
|
+
open: sections.notes,
|
|
4240
|
+
onToggle: () => toggle("notes"),
|
|
4241
|
+
action: detail.writeEnabled && !selfNote ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
4097
4242
|
type: "button",
|
|
4098
|
-
onClick: () =>
|
|
4099
|
-
|
|
4100
|
-
|
|
4101
|
-
|
|
4243
|
+
onClick: () => {
|
|
4244
|
+
if (!sections.notes) {
|
|
4245
|
+
setInfoSection("notes", true);
|
|
4246
|
+
setComposingNote(true);
|
|
4247
|
+
return;
|
|
4248
|
+
}
|
|
4249
|
+
setComposingNote((previous) => !previous);
|
|
4102
4250
|
},
|
|
4103
|
-
title: t("
|
|
4104
|
-
|
|
4105
|
-
|
|
4106
|
-
|
|
4107
|
-
|
|
4108
|
-
|
|
4109
|
-
|
|
4110
|
-
|
|
4111
|
-
|
|
4112
|
-
|
|
4113
|
-
|
|
4114
|
-
|
|
4115
|
-
|
|
4116
|
-
|
|
4117
|
-
|
|
4118
|
-
|
|
4119
|
-
|
|
4120
|
-
|
|
4121
|
-
|
|
4122
|
-
|
|
4123
|
-
|
|
4124
|
-
|
|
4125
|
-
|
|
4126
|
-
|
|
4127
|
-
|
|
4128
|
-
|
|
4129
|
-
|
|
4130
|
-
|
|
4131
|
-
|
|
4132
|
-
|
|
4133
|
-
|
|
4134
|
-
|
|
4135
|
-
|
|
4251
|
+
title: composingNote ? t("note.cancel") : t("note.new"),
|
|
4252
|
+
"aria-label": t("note.new"),
|
|
4253
|
+
style: blockActionStyle,
|
|
4254
|
+
children: composingNote ? "×" : "+"
|
|
4255
|
+
}) : void 0,
|
|
4256
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NoteList, {
|
|
4257
|
+
t,
|
|
4258
|
+
notes,
|
|
4259
|
+
itemKey: detail.key,
|
|
4260
|
+
canWrite: detail.writeEnabled,
|
|
4261
|
+
selfNote,
|
|
4262
|
+
composing: composingNote,
|
|
4263
|
+
onComposingChange: setComposingNote,
|
|
4264
|
+
onInsert: onInsertNote,
|
|
4265
|
+
onChanged
|
|
4266
|
+
})
|
|
4267
|
+
}),
|
|
4268
|
+
detail.attachments.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Block, {
|
|
4269
|
+
label: t("detail.attachments"),
|
|
4270
|
+
hint: String(detail.attachments.length),
|
|
4271
|
+
open: sections.attachments,
|
|
4272
|
+
onToggle: () => toggle("attachments"),
|
|
4273
|
+
children: detail.attachments.map((attachment) => {
|
|
4274
|
+
const current = attachment.key === currentAttachmentKey;
|
|
4275
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
4276
|
+
type: "button",
|
|
4277
|
+
onClick: () => onSelectAttachment(attachment.key),
|
|
4278
|
+
style: {
|
|
4279
|
+
...attachmentRowStyle,
|
|
4280
|
+
opacity: current ? 1 : .8
|
|
4281
|
+
},
|
|
4282
|
+
title: t("detail.attachmentOpen"),
|
|
4283
|
+
children: [
|
|
4284
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
4285
|
+
style: {
|
|
4286
|
+
width: 12,
|
|
4287
|
+
flexShrink: 0,
|
|
4288
|
+
color: "#508cff"
|
|
4289
|
+
},
|
|
4290
|
+
children: current ? "●" : ""
|
|
4291
|
+
}),
|
|
4292
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
4293
|
+
style: {
|
|
4294
|
+
flex: 1,
|
|
4295
|
+
textAlign: "left",
|
|
4296
|
+
wordBreak: "break-word"
|
|
4297
|
+
},
|
|
4298
|
+
children: attachment.filename || attachment.title
|
|
4299
|
+
}),
|
|
4300
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
4301
|
+
style: attachmentMetaStyle,
|
|
4302
|
+
children: [attachment.contentType, attachment.size > 0 ? ` · ${Math.round(attachment.size / 1024)} KB` : ""]
|
|
4303
|
+
})
|
|
4304
|
+
]
|
|
4305
|
+
}, attachment.key);
|
|
4306
|
+
})
|
|
4307
|
+
}),
|
|
4308
|
+
detail.bib !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Block, {
|
|
4309
|
+
label: t("detail.bibTitle"),
|
|
4310
|
+
open: sections.bib,
|
|
4311
|
+
onToggle: () => toggle("bib"),
|
|
4312
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
4313
|
+
style: paragraphStyle,
|
|
4314
|
+
children: stripTags(detail.bib)
|
|
4315
|
+
})
|
|
4136
4316
|
})
|
|
4137
|
-
|
|
4138
|
-
|
|
4139
|
-
|
|
4317
|
+
]
|
|
4318
|
+
})
|
|
4319
|
+
]
|
|
4140
4320
|
});
|
|
4141
4321
|
}
|
|
4142
4322
|
const rootStyle$6 = {
|
|
@@ -4145,7 +4325,7 @@ const rootStyle$6 = {
|
|
|
4145
4325
|
zIndex: 20,
|
|
4146
4326
|
pointerEvents: "none"
|
|
4147
4327
|
};
|
|
4148
|
-
/**
|
|
4328
|
+
/** 这一行按钮从左往右:目录(8)、文献信息(34)、加入对话(60),每个 22 高、间隔 4。 */
|
|
4149
4329
|
const triggerStyle$1 = {
|
|
4150
4330
|
position: "absolute",
|
|
4151
4331
|
pointerEvents: "auto",
|
|
@@ -4200,13 +4380,27 @@ const panelTitleStyle = {
|
|
|
4200
4380
|
lineHeight: 1.45,
|
|
4201
4381
|
wordBreak: "break-word"
|
|
4202
4382
|
};
|
|
4203
|
-
|
|
4204
|
-
|
|
4205
|
-
|
|
4206
|
-
|
|
4207
|
-
|
|
4208
|
-
|
|
4209
|
-
|
|
4383
|
+
/** 收在 `i` 右边、跟它同一行:是每次读文献都要点的主操作,不藏进浮层。 */
|
|
4384
|
+
const citeTriggerStyle = {
|
|
4385
|
+
position: "absolute",
|
|
4386
|
+
pointerEvents: "auto",
|
|
4387
|
+
top: 4,
|
|
4388
|
+
left: 60,
|
|
4389
|
+
display: "inline-flex",
|
|
4390
|
+
alignItems: "center",
|
|
4391
|
+
height: 22,
|
|
4392
|
+
padding: "0 9px",
|
|
4393
|
+
fontSize: 11.5,
|
|
4394
|
+
fontWeight: 500,
|
|
4395
|
+
lineHeight: 1,
|
|
4396
|
+
whiteSpace: "nowrap",
|
|
4397
|
+
borderRadius: 11,
|
|
4398
|
+
border: "1px solid rgba(127,127,127,0.4)",
|
|
4399
|
+
background: "Canvas",
|
|
4400
|
+
color: "CanvasText",
|
|
4401
|
+
cursor: "pointer",
|
|
4402
|
+
boxShadow: "0 1px 4px rgba(0,0,0,0.18)",
|
|
4403
|
+
zIndex: 21
|
|
4210
4404
|
};
|
|
4211
4405
|
const blockStyle = {
|
|
4212
4406
|
borderBottom: "1px solid rgba(127,127,127,0.18)",
|
|
@@ -27995,7 +28189,7 @@ function AnnotationCard({ t, annotation, style, cardRef, canEdit, onClose, onIns
|
|
|
27995
28189
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
27996
28190
|
type: "button",
|
|
27997
28191
|
onClick: onClose,
|
|
27998
|
-
style: iconButtonStyle,
|
|
28192
|
+
style: iconButtonStyle$1,
|
|
27999
28193
|
"aria-label": t("viewer.close"),
|
|
28000
28194
|
children: "×"
|
|
28001
28195
|
})
|
|
@@ -28188,7 +28382,7 @@ const swatchStyle$1 = {
|
|
|
28188
28382
|
border: "none",
|
|
28189
28383
|
cursor: "pointer"
|
|
28190
28384
|
};
|
|
28191
|
-
const iconButtonStyle = {
|
|
28385
|
+
const iconButtonStyle$1 = {
|
|
28192
28386
|
width: 20,
|
|
28193
28387
|
height: 20,
|
|
28194
28388
|
padding: 0,
|
|
@@ -31000,18 +31194,63 @@ function PageField({ current, total, onJump, t }) {
|
|
|
31000
31194
|
})]
|
|
31001
31195
|
});
|
|
31002
31196
|
}
|
|
31197
|
+
/**
|
|
31198
|
+
* 放大镜图标:镜筒里一根横线是缩小,再加一根竖线是放大,把手朝右下。
|
|
31199
|
+
*
|
|
31200
|
+
* 纯 `currentColor` 描边,深浅主题都跟着文字走。
|
|
31201
|
+
*/
|
|
31202
|
+
function ZoomIcon({ kind }) {
|
|
31203
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
31204
|
+
width: "15",
|
|
31205
|
+
height: "15",
|
|
31206
|
+
viewBox: "0 0 16 16",
|
|
31207
|
+
"aria-hidden": "true",
|
|
31208
|
+
focusable: "false",
|
|
31209
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("g", {
|
|
31210
|
+
fill: "none",
|
|
31211
|
+
stroke: "currentColor",
|
|
31212
|
+
strokeWidth: "1.35",
|
|
31213
|
+
strokeLinecap: "round",
|
|
31214
|
+
children: [
|
|
31215
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
|
|
31216
|
+
cx: "6.8",
|
|
31217
|
+
cy: "6.8",
|
|
31218
|
+
r: "4.4"
|
|
31219
|
+
}),
|
|
31220
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("line", {
|
|
31221
|
+
x1: "10.15",
|
|
31222
|
+
y1: "10.15",
|
|
31223
|
+
x2: "13.6",
|
|
31224
|
+
y2: "13.6"
|
|
31225
|
+
}),
|
|
31226
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("line", {
|
|
31227
|
+
x1: "4.8",
|
|
31228
|
+
y1: "6.8",
|
|
31229
|
+
x2: "8.8",
|
|
31230
|
+
y2: "6.8"
|
|
31231
|
+
}),
|
|
31232
|
+
kind === "in" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("line", {
|
|
31233
|
+
x1: "6.8",
|
|
31234
|
+
y1: "4.8",
|
|
31235
|
+
x2: "6.8",
|
|
31236
|
+
y2: "8.8"
|
|
31237
|
+
})
|
|
31238
|
+
]
|
|
31239
|
+
})
|
|
31240
|
+
});
|
|
31241
|
+
}
|
|
31003
31242
|
function DocumentView({ t, detail, source, annotations, viewerRef, onReady, onInsertExcerpt, onInsertAnnotation, onOpenInZotero, onChanged, onOutlineChange }) {
|
|
31004
31243
|
const renderer = pickRenderer(source, detail);
|
|
31005
31244
|
const Renderer = renderer.Component;
|
|
31006
|
-
const [zoom, setZoom] = (0, react.useState)({
|
|
31007
|
-
percent: 100,
|
|
31008
|
-
fitWidth: true
|
|
31009
|
-
});
|
|
31010
31245
|
const [page, setPage] = (0, react.useState)({
|
|
31011
31246
|
current: 1,
|
|
31012
31247
|
total: 0
|
|
31013
31248
|
});
|
|
31014
|
-
|
|
31249
|
+
/**
|
|
31250
|
+
* 缩放比例不再显示,但这个回调渲染器还得有(`RendererProps` 必填)。
|
|
31251
|
+
* 留着空实现而不是改接口:唯一用处是给工具条写字,删掉它要动三个渲染器。
|
|
31252
|
+
*/
|
|
31253
|
+
const handleZoomChange = (0, react.useCallback)(() => {}, []);
|
|
31015
31254
|
const handlePageChange = (0, react.useCallback)((current, total) => {
|
|
31016
31255
|
setPage({
|
|
31017
31256
|
current,
|
|
@@ -31039,43 +31278,34 @@ function DocumentView({ t, detail, source, annotations, viewerRef, onReady, onIn
|
|
|
31039
31278
|
onJump: (target) => viewerRef.current?.goToPage(target),
|
|
31040
31279
|
t
|
|
31041
31280
|
}),
|
|
31042
|
-
renderer.capabilities.zoom && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
31043
|
-
|
|
31281
|
+
renderer.capabilities.zoom && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
31282
|
+
style: barDividerStyle,
|
|
31283
|
+
"aria-hidden": "true"
|
|
31284
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
31285
|
+
style: zoomGroupStyle,
|
|
31286
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
31044
31287
|
type: "button",
|
|
31045
31288
|
onClick: () => viewerRef.current?.zoomOut(),
|
|
31046
|
-
style:
|
|
31289
|
+
style: iconButtonStyle,
|
|
31047
31290
|
"aria-label": t("viewer.zoomOut"),
|
|
31048
31291
|
title: t("viewer.zoomOut"),
|
|
31049
|
-
children: "
|
|
31050
|
-
}),
|
|
31051
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
31052
|
-
style: zoomStyle,
|
|
31053
|
-
children: [zoom.percent, "%"]
|
|
31054
|
-
}),
|
|
31055
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
31292
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ZoomIcon, { kind: "out" })
|
|
31293
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
31056
31294
|
type: "button",
|
|
31057
31295
|
onClick: () => viewerRef.current?.zoomIn(),
|
|
31058
|
-
style:
|
|
31296
|
+
style: iconButtonStyle,
|
|
31059
31297
|
"aria-label": t("viewer.zoomIn"),
|
|
31060
31298
|
title: t("viewer.zoomIn"),
|
|
31061
|
-
children: "
|
|
31062
|
-
})
|
|
31063
|
-
|
|
31064
|
-
type: "button",
|
|
31065
|
-
onClick: () => viewerRef.current?.fitToWidth(),
|
|
31066
|
-
style: {
|
|
31067
|
-
...toolButtonStyle,
|
|
31068
|
-
opacity: zoom.fitWidth ? 1 : .6
|
|
31069
|
-
},
|
|
31070
|
-
"aria-label": t("viewer.fitWidth"),
|
|
31071
|
-
title: t("viewer.fitWidth"),
|
|
31072
|
-
children: "⤢"
|
|
31073
|
-
})
|
|
31074
|
-
] }),
|
|
31299
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ZoomIcon, { kind: "in" })
|
|
31300
|
+
})]
|
|
31301
|
+
})] }),
|
|
31075
31302
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
31076
31303
|
type: "button",
|
|
31077
31304
|
onClick: () => onOpenInZotero(page.current),
|
|
31078
|
-
style:
|
|
31305
|
+
style: {
|
|
31306
|
+
...toolButtonStyle,
|
|
31307
|
+
marginLeft: GROUP_GAP
|
|
31308
|
+
},
|
|
31079
31309
|
title: t("viewer.openInZotero"),
|
|
31080
31310
|
children: t("viewer.openInZoteroShort")
|
|
31081
31311
|
})
|
|
@@ -31104,14 +31334,19 @@ function DocumentView({ t, detail, source, annotations, viewerRef, onReady, onIn
|
|
|
31104
31334
|
})]
|
|
31105
31335
|
});
|
|
31106
31336
|
}
|
|
31107
|
-
/**
|
|
31337
|
+
/**
|
|
31338
|
+
* 左侧留出三个悬浮按钮(目录 / 文献信息 / 加入对话)的位置,标题居中显示在剩下这段里。
|
|
31339
|
+
*
|
|
31340
|
+
* 悬浮按钮是绝对定位、盖在工具条上的(见 `OutlinePanel` / `InfoPanel`:8 + 22 + 4 一格,
|
|
31341
|
+
* 第三格「加入对话」到 124 为止),所以这里的 `paddingLeft` 必须一起改,否则标题从按钮底下钻出来。
|
|
31342
|
+
*/
|
|
31108
31343
|
const barStyle = {
|
|
31109
31344
|
display: "flex",
|
|
31110
31345
|
alignItems: "center",
|
|
31111
31346
|
gap: 4,
|
|
31112
31347
|
flexShrink: 0,
|
|
31113
31348
|
height: 30,
|
|
31114
|
-
padding: "0 8px 0
|
|
31349
|
+
padding: "0 8px 0 132px",
|
|
31115
31350
|
borderBottom: "1px solid rgba(127,127,127,0.2)",
|
|
31116
31351
|
background: "transparent"
|
|
31117
31352
|
};
|
|
@@ -31121,9 +31356,16 @@ const titleStyle$1 = {
|
|
|
31121
31356
|
overflow: "hidden",
|
|
31122
31357
|
textOverflow: "ellipsis",
|
|
31123
31358
|
whiteSpace: "nowrap",
|
|
31359
|
+
textAlign: "center",
|
|
31124
31360
|
fontSize: 11,
|
|
31125
31361
|
opacity: .62
|
|
31126
31362
|
};
|
|
31363
|
+
/**
|
|
31364
|
+
* 工具条里相邻两组控件之间的额外间距(页码 ↔ 缩放 ↔ Zotero)。
|
|
31365
|
+
*
|
|
31366
|
+
* 组内只隔 4(工具条的 `gap`),组间靠这个拉开,否则 `1 / 3` 和两个放大镜会连成一片。
|
|
31367
|
+
*/
|
|
31368
|
+
const GROUP_GAP = 10;
|
|
31127
31369
|
const pageStyle = {
|
|
31128
31370
|
flexShrink: 0,
|
|
31129
31371
|
display: "inline-flex",
|
|
@@ -31146,13 +31388,36 @@ const pageInputStyle = {
|
|
|
31146
31388
|
color: "inherit",
|
|
31147
31389
|
outline: "none"
|
|
31148
31390
|
};
|
|
31149
|
-
|
|
31391
|
+
/** 页码区与缩放区之间的竖线:比纯靠留白更能看出是两组。 */
|
|
31392
|
+
const barDividerStyle = {
|
|
31150
31393
|
flexShrink: 0,
|
|
31151
|
-
|
|
31152
|
-
|
|
31153
|
-
|
|
31154
|
-
|
|
31155
|
-
|
|
31394
|
+
width: 1,
|
|
31395
|
+
height: 14,
|
|
31396
|
+
margin: "0 3px 0 8px",
|
|
31397
|
+
background: "rgba(127,127,127,0.28)"
|
|
31398
|
+
};
|
|
31399
|
+
/** 缩放组(两个放大镜):不再显示百分比,纯图标。 */
|
|
31400
|
+
const zoomGroupStyle = {
|
|
31401
|
+
flexShrink: 0,
|
|
31402
|
+
display: "inline-flex",
|
|
31403
|
+
alignItems: "center",
|
|
31404
|
+
gap: 2
|
|
31405
|
+
};
|
|
31406
|
+
/** 无边框图标按钮:放大镜本身当按钮,不再套一层方框。 */
|
|
31407
|
+
const iconButtonStyle = {
|
|
31408
|
+
flexShrink: 0,
|
|
31409
|
+
display: "inline-flex",
|
|
31410
|
+
alignItems: "center",
|
|
31411
|
+
justifyContent: "center",
|
|
31412
|
+
width: 22,
|
|
31413
|
+
height: 22,
|
|
31414
|
+
padding: 0,
|
|
31415
|
+
borderRadius: 4,
|
|
31416
|
+
border: "none",
|
|
31417
|
+
background: "transparent",
|
|
31418
|
+
color: "inherit",
|
|
31419
|
+
opacity: .75,
|
|
31420
|
+
cursor: "pointer"
|
|
31156
31421
|
};
|
|
31157
31422
|
const toolButtonStyle = {
|
|
31158
31423
|
flexShrink: 0,
|
|
@@ -32121,7 +32386,9 @@ function SearchField({ value, placeholder, clearLabel, onChange }) {
|
|
|
32121
32386
|
* 头部含范围名、条数与搜索框;条目行单击选中、双击才开独立 tab,ctrl / cmd 点选
|
|
32122
32387
|
* 多选,右上角「引用 N」把选中的每条各插一个胶囊。右键单行仍能直接插该条引用。
|
|
32123
32388
|
* 列表分页(加载更多),筛选后为空与本来为空分开提示。
|
|
32124
|
-
*
|
|
32389
|
+
*
|
|
32390
|
+
* 行内排版是两行:第一行只放标题,第二行小字灰色放「类型 + 年份 + 作者」,
|
|
32391
|
+
* 行与行之间用一条浅色细线分隔。
|
|
32125
32392
|
*/
|
|
32126
32393
|
function selectionName(t, libraryName, collection) {
|
|
32127
32394
|
if (collection === null || collection.key === "__library__") return libraryName === "" ? t("tab.title") : libraryName;
|
|
@@ -32146,34 +32413,72 @@ const titleRowStyle = {
|
|
|
32146
32413
|
gap: 8,
|
|
32147
32414
|
minWidth: 0
|
|
32148
32415
|
};
|
|
32416
|
+
/** 行 hover 只染未选中行:选中态用内联背景,优先级更高,不需要额外规则。 */
|
|
32417
|
+
const ITEM_CSS = ".dsh-zotero-item-row:hover{background:rgba(127,127,127,0.08)}";
|
|
32418
|
+
/** 行外壳:只负责那条浅色分隔线,通栏铺满。
|
|
32419
|
+
*
|
|
32420
|
+
* 用 flex 是为了「撑满」:Menu 的 anchor 外面会包一层按内容收窄的元素,
|
|
32421
|
+
* 做成 flex 容器后那层被拉伸到整行宽,里面的标题才有确定的宽度可截断。
|
|
32422
|
+
*/
|
|
32423
|
+
const itemShellStyle = {
|
|
32424
|
+
display: "flex",
|
|
32425
|
+
borderBottom: "1px solid rgba(127,127,127,0.14)"
|
|
32426
|
+
};
|
|
32149
32427
|
const itemRowStyle = {
|
|
32150
32428
|
display: "flex",
|
|
32151
|
-
|
|
32152
|
-
|
|
32153
|
-
|
|
32154
|
-
|
|
32155
|
-
|
|
32156
|
-
borderRadius:
|
|
32429
|
+
alignItems: "flex-start",
|
|
32430
|
+
gap: 7,
|
|
32431
|
+
width: "100%",
|
|
32432
|
+
boxSizing: "border-box",
|
|
32433
|
+
padding: "7px 8px",
|
|
32434
|
+
borderRadius: 6,
|
|
32157
32435
|
cursor: "pointer"
|
|
32158
32436
|
};
|
|
32437
|
+
/** 标题独占第一行,可截断。 */
|
|
32159
32438
|
const itemTitleStyle = {
|
|
32160
|
-
|
|
32439
|
+
display: "block",
|
|
32161
32440
|
minWidth: 0,
|
|
32162
32441
|
overflow: "hidden",
|
|
32163
32442
|
textOverflow: "ellipsis",
|
|
32164
|
-
whiteSpace: "nowrap"
|
|
32443
|
+
whiteSpace: "nowrap",
|
|
32444
|
+
fontSize: 13,
|
|
32445
|
+
lineHeight: 1.45
|
|
32165
32446
|
};
|
|
32447
|
+
/** 第二行:类型 + 年份 + 作者,小字灰。 */
|
|
32166
32448
|
const itemMetaStyle = {
|
|
32167
|
-
|
|
32449
|
+
display: "flex",
|
|
32450
|
+
alignItems: "baseline",
|
|
32451
|
+
gap: 6,
|
|
32452
|
+
minWidth: 0,
|
|
32453
|
+
marginTop: 1,
|
|
32454
|
+
fontSize: 11,
|
|
32455
|
+
lineHeight: 1.4,
|
|
32456
|
+
opacity: .5
|
|
32457
|
+
};
|
|
32458
|
+
/** 类型与年份比作者再淡一点:作者是主要识别信息。 */
|
|
32459
|
+
const itemMetaTypeStyle = {
|
|
32168
32460
|
flex: "0 0 auto",
|
|
32169
|
-
|
|
32170
|
-
|
|
32171
|
-
|
|
32461
|
+
opacity: .85
|
|
32462
|
+
};
|
|
32463
|
+
const itemMetaYearStyle = {
|
|
32464
|
+
flex: "0 0 auto",
|
|
32465
|
+
opacity: .85
|
|
32466
|
+
};
|
|
32467
|
+
const itemMetaTextStyle = {
|
|
32468
|
+
flex: "1 1 auto",
|
|
32469
|
+
minWidth: 0,
|
|
32470
|
+
overflow: "hidden",
|
|
32471
|
+
textOverflow: "ellipsis",
|
|
32472
|
+
whiteSpace: "nowrap"
|
|
32473
|
+
};
|
|
32474
|
+
const itemBodyStyle = {
|
|
32475
|
+
flex: 1,
|
|
32476
|
+
minWidth: 0
|
|
32172
32477
|
};
|
|
32173
32478
|
const itemIconStyle = {
|
|
32174
32479
|
display: "flex",
|
|
32175
|
-
|
|
32176
|
-
|
|
32480
|
+
flexShrink: 0,
|
|
32481
|
+
marginTop: 3
|
|
32177
32482
|
};
|
|
32178
32483
|
/** 头部引用按钮的紧凑尺寸。 */
|
|
32179
32484
|
const citeButtonStyle = {
|
|
@@ -32183,6 +32488,47 @@ const citeButtonStyle = {
|
|
|
32183
32488
|
fontSize: 11,
|
|
32184
32489
|
lineHeight: 1.2
|
|
32185
32490
|
};
|
|
32491
|
+
/** 排序图标按钮:与引用按钮同高,只放图标。 */
|
|
32492
|
+
const sortButtonStyle = {
|
|
32493
|
+
flexShrink: 0,
|
|
32494
|
+
height: 20,
|
|
32495
|
+
padding: "0 4px",
|
|
32496
|
+
lineHeight: 1
|
|
32497
|
+
};
|
|
32498
|
+
/** 排序生效时的图标颜色(与列表选中态同一支蓝)。 */
|
|
32499
|
+
const SORT_ACTIVE_COLOR = "#508cff";
|
|
32500
|
+
/**
|
|
32501
|
+
* 排序图标:三条长短不一的横线 + 右侧方向箭头。
|
|
32502
|
+
*
|
|
32503
|
+
* 未排序时箭头两头都画(提示「可点」)且整体偏淡;正序朝上、倒序朝下并染色。
|
|
32504
|
+
*/
|
|
32505
|
+
function SortIcon({ sort }) {
|
|
32506
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
|
|
32507
|
+
width: 14,
|
|
32508
|
+
height: 14,
|
|
32509
|
+
viewBox: "0 0 16 16",
|
|
32510
|
+
fill: "none",
|
|
32511
|
+
stroke: "currentColor",
|
|
32512
|
+
strokeWidth: 1.3,
|
|
32513
|
+
strokeLinecap: "round",
|
|
32514
|
+
strokeLinejoin: "round",
|
|
32515
|
+
"aria-hidden": true,
|
|
32516
|
+
focusable: "false",
|
|
32517
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
32518
|
+
d: "M2.4 3.6h7.2M2.4 8h4.8M2.4 12.4h2.8",
|
|
32519
|
+
opacity: sort !== "none" ? 1 : .75
|
|
32520
|
+
}), sort === "none" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
32521
|
+
d: "M13 4.2v7.6M13 4.2l-1.5 1.7M13 4.2l1.5 1.7M13 11.8l-1.5-1.7M13 11.8l1.5-1.7",
|
|
32522
|
+
opacity: .5
|
|
32523
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: sort === "asc" ? "M13 12.2V4M13 4l-1.7 1.9M13 4l1.7 1.9" : "M13 3.8V12M13 12l-1.7-1.9M13 12l1.7-1.9" })]
|
|
32524
|
+
});
|
|
32525
|
+
}
|
|
32526
|
+
/** 排序按钮的提示文案随状态变,点了知道下一步会变成什么。 */
|
|
32527
|
+
function sortHint(t, sort) {
|
|
32528
|
+
if (sort === "asc") return t("list.sortAsc");
|
|
32529
|
+
if (sort === "desc") return t("list.sortDesc");
|
|
32530
|
+
return t("list.sortNone");
|
|
32531
|
+
}
|
|
32186
32532
|
/** 筛选摘要里的小胶囊。 */
|
|
32187
32533
|
const chipStyle = {
|
|
32188
32534
|
display: "inline-flex",
|
|
@@ -32208,57 +32554,73 @@ const chipRemoveStyle = {
|
|
|
32208
32554
|
function ItemRow({ t, item, selected, onSelect, onOpen, onInsert }) {
|
|
32209
32555
|
const [menuOpen, setMenuOpen] = (0, react.useState)(false);
|
|
32210
32556
|
const read = isRead(item);
|
|
32211
|
-
const
|
|
32212
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
32213
|
-
|
|
32214
|
-
|
|
32215
|
-
|
|
32216
|
-
setMenuOpen(false)
|
|
32217
|
-
|
|
32218
|
-
|
|
32219
|
-
|
|
32220
|
-
portal: true,
|
|
32221
|
-
items: [{
|
|
32222
|
-
id: "insert-item",
|
|
32223
|
-
label: t("action.insertItem")
|
|
32224
|
-
}],
|
|
32225
|
-
anchor: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
32226
|
-
title: itemTooltip(t, item),
|
|
32227
|
-
onClick: (event) => onSelect(item.key, event.ctrlKey || event.metaKey),
|
|
32228
|
-
onDoubleClick: () => onOpen(item.key, item.title),
|
|
32229
|
-
onContextMenu: (event) => {
|
|
32230
|
-
event.preventDefault();
|
|
32231
|
-
setMenuOpen(true);
|
|
32232
|
-
},
|
|
32233
|
-
style: {
|
|
32234
|
-
...itemRowStyle,
|
|
32235
|
-
background: selected ? "rgba(80,140,255,0.18)" : "transparent"
|
|
32557
|
+
const typeLabel = itemTypeLabel(t, item.itemType);
|
|
32558
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
32559
|
+
style: itemShellStyle,
|
|
32560
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Menu, {
|
|
32561
|
+
open: menuOpen,
|
|
32562
|
+
onClose: () => setMenuOpen(false),
|
|
32563
|
+
onSelect: (id) => {
|
|
32564
|
+
setMenuOpen(false);
|
|
32565
|
+
if (id === "insert-item") onInsert(item);
|
|
32236
32566
|
},
|
|
32237
|
-
|
|
32238
|
-
|
|
32567
|
+
align: "end",
|
|
32568
|
+
portal: true,
|
|
32569
|
+
items: [{
|
|
32570
|
+
id: "insert-item",
|
|
32571
|
+
label: t("action.insertItem")
|
|
32572
|
+
}],
|
|
32573
|
+
anchor: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
32574
|
+
className: "dsh-zotero-item-row",
|
|
32575
|
+
title: itemTooltip(t, item),
|
|
32576
|
+
onClick: (event) => onSelect(item.key, event.ctrlKey || event.metaKey),
|
|
32577
|
+
onDoubleClick: () => onOpen(item.key, item.title),
|
|
32578
|
+
onContextMenu: (event) => {
|
|
32579
|
+
event.preventDefault();
|
|
32580
|
+
setMenuOpen(true);
|
|
32581
|
+
},
|
|
32582
|
+
style: selected ? {
|
|
32583
|
+
...itemRowStyle,
|
|
32584
|
+
background: "rgba(80,140,255,0.16)"
|
|
32585
|
+
} : itemRowStyle,
|
|
32586
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
32239
32587
|
style: itemIconStyle,
|
|
32240
32588
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ItemTypeIcon, {
|
|
32241
32589
|
itemType: item.itemType,
|
|
32242
32590
|
read
|
|
32243
32591
|
})
|
|
32244
|
-
}),
|
|
32245
|
-
|
|
32246
|
-
|
|
32247
|
-
|
|
32248
|
-
|
|
32249
|
-
|
|
32250
|
-
|
|
32251
|
-
|
|
32252
|
-
|
|
32253
|
-
|
|
32254
|
-
|
|
32255
|
-
|
|
32256
|
-
|
|
32592
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
32593
|
+
style: itemBodyStyle,
|
|
32594
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
32595
|
+
style: {
|
|
32596
|
+
...itemTitleStyle,
|
|
32597
|
+
...readTitleStyle(read)
|
|
32598
|
+
},
|
|
32599
|
+
children: item.title
|
|
32600
|
+
}), (typeLabel !== "" || item.year !== "" || item.creators !== "") && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
32601
|
+
style: itemMetaStyle,
|
|
32602
|
+
children: [
|
|
32603
|
+
typeLabel !== "" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
32604
|
+
style: itemMetaTypeStyle,
|
|
32605
|
+
children: typeLabel
|
|
32606
|
+
}),
|
|
32607
|
+
item.year !== "" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
32608
|
+
style: itemMetaYearStyle,
|
|
32609
|
+
children: item.year
|
|
32610
|
+
}),
|
|
32611
|
+
item.creators !== "" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
32612
|
+
style: itemMetaTextStyle,
|
|
32613
|
+
children: item.creators
|
|
32614
|
+
})
|
|
32615
|
+
]
|
|
32616
|
+
})]
|
|
32617
|
+
})]
|
|
32618
|
+
})
|
|
32257
32619
|
})
|
|
32258
32620
|
});
|
|
32259
32621
|
}
|
|
32260
32622
|
function ItemList(props) {
|
|
32261
|
-
const { t, libraryName, selectedCollection, query, items, itemsTotal, itemsLoading, itemsError, selectedTags, tagMode, selectedItemKeys, onSearch, onRemoveTag, onRetry, onLoadMore, onOpenItem, onSelectItem, onClearSelection, onInsertItem, onInsertItems, onInsertCollection } = props;
|
|
32623
|
+
const { t, libraryName, selectedCollection, query, items, itemsTotal, itemsLoading, itemsError, selectedTags, tagMode, sort, selectedItemKeys, onSearch, onRemoveTag, onRetry, onLoadMore, onCycleSort, onOpenItem, onSelectItem, onClearSelection, onInsertItem, onInsertItems, onInsertCollection } = props;
|
|
32262
32624
|
const name = selectionName(t, libraryName, selectedCollection);
|
|
32263
32625
|
const isRealCollection = selectedCollection !== null && selectedCollection.key !== "__library__" && selectedCollection.scope === void 0;
|
|
32264
32626
|
const tags = [...selectedTags];
|
|
@@ -32310,7 +32672,19 @@ function ItemList(props) {
|
|
|
32310
32672
|
style: citeButtonStyle,
|
|
32311
32673
|
onClick: () => onInsertCollection(selectedCollection),
|
|
32312
32674
|
children: t("action.insertItemShort")
|
|
32313
|
-
}) : null
|
|
32675
|
+
}) : null,
|
|
32676
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
32677
|
+
variant: "ghost",
|
|
32678
|
+
size: "sm",
|
|
32679
|
+
title: sortHint(t, sort),
|
|
32680
|
+
"aria-label": sortHint(t, sort),
|
|
32681
|
+
style: sort === "none" ? sortButtonStyle : {
|
|
32682
|
+
...sortButtonStyle,
|
|
32683
|
+
color: SORT_ACTIVE_COLOR
|
|
32684
|
+
},
|
|
32685
|
+
onClick: onCycleSort,
|
|
32686
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SortIcon, { sort })
|
|
32687
|
+
})
|
|
32314
32688
|
]
|
|
32315
32689
|
}),
|
|
32316
32690
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(SearchField, {
|
|
@@ -32351,17 +32725,18 @@ function ItemList(props) {
|
|
|
32351
32725
|
})]
|
|
32352
32726
|
})
|
|
32353
32727
|
]
|
|
32354
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.
|
|
32728
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
32355
32729
|
onClick: (event) => {
|
|
32356
32730
|
if (event.target === event.currentTarget) onClearSelection();
|
|
32357
32731
|
},
|
|
32358
32732
|
style: {
|
|
32359
32733
|
flex: 1,
|
|
32360
32734
|
minHeight: 0,
|
|
32361
|
-
|
|
32362
|
-
|
|
32735
|
+
overflowX: "hidden",
|
|
32736
|
+
overflowY: "auto",
|
|
32737
|
+
padding: "2px 6px 8px"
|
|
32363
32738
|
},
|
|
32364
|
-
children: itemsError !== null && items.length === 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
32739
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("style", { children: ITEM_CSS }), itemsError !== null && items.length === 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
32365
32740
|
style: {
|
|
32366
32741
|
padding: "12px 8px",
|
|
32367
32742
|
fontSize: 12.5,
|
|
@@ -32398,7 +32773,7 @@ function ItemList(props) {
|
|
|
32398
32773
|
onClick: onLoadMore,
|
|
32399
32774
|
children: t("list.loadMore")
|
|
32400
32775
|
})
|
|
32401
|
-
})] })
|
|
32776
|
+
})] })]
|
|
32402
32777
|
})]
|
|
32403
32778
|
});
|
|
32404
32779
|
}
|
|
@@ -32798,7 +33173,7 @@ function StatusDot({ ok, label }) {
|
|
|
32798
33173
|
});
|
|
32799
33174
|
}
|
|
32800
33175
|
function ZoteroPane({ t, inputActions, sessions, sessionId, onOpenItem }) {
|
|
32801
|
-
const { health, libraryName, collections, treeError, treeLoading, selectedCollection, query, items, itemsTotal, itemsLoading, itemsError, tags, tagsLoading, tagsError, treeQuery, tagQuery, selectedTags, tagMode, tagUsage, tagUsageLoading, selectedItemKeys } = usePaneState();
|
|
33176
|
+
const { health, libraryName, collections, treeError, treeLoading, selectedCollection, query, items, itemsTotal, itemsLoading, itemsError, tags, tagsLoading, tagsError, treeQuery, tagQuery, selectedTags, tagMode, tagUsage, tagUsageLoading, sort, selectedItemKeys } = usePaneState();
|
|
32802
33177
|
(0, react.useEffect)(() => {
|
|
32803
33178
|
loadTree();
|
|
32804
33179
|
}, []);
|
|
@@ -32993,11 +33368,13 @@ function ZoteroPane({ t, inputActions, sessions, sessionId, onOpenItem }) {
|
|
|
32993
33368
|
itemsError,
|
|
32994
33369
|
selectedTags,
|
|
32995
33370
|
tagMode,
|
|
33371
|
+
sort,
|
|
32996
33372
|
selectedItemKeys,
|
|
32997
33373
|
onSearch: setQuery,
|
|
32998
33374
|
onRemoveTag: toggleTag,
|
|
32999
33375
|
onRetry: retryItems,
|
|
33000
33376
|
onLoadMore: loadMoreItems,
|
|
33377
|
+
onCycleSort: cycleItemSort,
|
|
33001
33378
|
onOpenItem,
|
|
33002
33379
|
onSelectItem: selectItem,
|
|
33003
33380
|
onClearSelection: clearItemSelection,
|