dsh-plugin-zotero 0.1.2 → 0.1.4
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/README.md +75 -17
- package/client/client.js +402 -117
- package/lib/zotero/client.d.ts +6 -1
- package/lib/zotero/client.js +94 -3
- package/lib/zotero/types.d.ts +13 -0
- package/package.json +9 -9
package/README.md
CHANGED
|
@@ -1,19 +1,31 @@
|
|
|
1
1
|
# dsh-plugin-zotero
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**把 Zotero 和 DSH 连起来。**
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|---|---|---|
|
|
7
|
-
| **人侧面板** | 在 DSH 右侧栏只读浏览 Zotero 文库(分类树 / 搜索 / 条目详情 / PDF 全文),把条目、摘录或整目录引用写进会话草稿 | 插件在宿主 web server 自注册的 `/dsh-zotero/api/*` 路由 |
|
|
8
|
-
| **模型侧** | 检索、精读、按需操作文库 | 插件**自持**连接本机 Zotero 集成 MCP,工具以 `mcp__zotero__*` 注册给模型 |
|
|
5
|
+
装好这个插件,大模型就能直接查看、检索和读取你 Zotero 里的文献、笔记和 PDF 全文;你也可以在 DSH 右侧栏浏览自己的文库,把条目、摘录或整个目录一键带进对话。
|
|
9
6
|
|
|
10
|
-
|
|
7
|
+
不用写代码,也不用记命令。第一次使用前,只需在 Zotero 里完成两项一次性设置(装一个桥接小插件、打开通信开关),步骤见[使用前提](#使用前提)。
|
|
8
|
+
|
|
9
|
+
## 截图
|
|
10
|
+
|
|
11
|
+
[](docs/images/zotero-pane.png)
|
|
12
|
+
|
|
13
|
+
<sub>上图为 DSH 会话与右侧「Zotero 文献库」面板:上方正文区展示元数据与全文,下方分区 tab 展示参考文献、笔记与附件,点击图片可查看原图。</sub>
|
|
14
|
+
|
|
15
|
+
一句话概括它能做什么:
|
|
16
|
+
|
|
17
|
+
- **浏览与检索**:按 Zotero 分类逐级浏览文库,按标题 / 摘要搜索,查看条目的元数据、摘要、参考文献、笔记、附件与 PDF 全文。
|
|
18
|
+
- **带进对话**:单条目引用、全文划词摘录或整目录引用,一键写进当前会话草稿(不自动发送),模型可以接着基于它工作。
|
|
19
|
+
- **交给模型**:让大模型帮你找文献、读全文、整理笔记,必要时按你的要求调整分类;不想让模型改文库,可以逐个关掉写操作。
|
|
20
|
+
- **安全可控**:浏览面板严格只读;模型能做什么可以逐项开关。
|
|
21
|
+
|
|
22
|
+
面板分三块:顶部状态栏显示连接状态并提供刷新;左侧分类树按分类浏览与搜索;右侧详情区展示正文与「参考文献 / 笔记 / 附件」标签页。
|
|
11
23
|
|
|
12
24
|
> 面向使用者的完整说明(入口、交互、toast 与错误对照表)见 [插件使用说明](docs/插件使用说明/dsh-plugin-zotero使用说明.zh.md)。
|
|
13
25
|
|
|
14
26
|
## 安装
|
|
15
27
|
|
|
16
|
-
要求 dsh ≥ 0.2.
|
|
28
|
+
要求 dsh ≥ 0.2.1-rc.3(`package.json` 的 `engines.dsh` 为 `>=0.2.1-rc.3 <0.3.0-0`)。
|
|
17
29
|
|
|
18
30
|
```sh
|
|
19
31
|
# 从 npm(推荐)
|
|
@@ -25,9 +37,44 @@ dsh plugin --profile <profile> add dsh-plugin-zotero
|
|
|
25
37
|
|
|
26
38
|
包内是预构建产物(`lib/` + `client/client.js`),安装时**不运行构建脚本**,无需 `allowBuilds` 授权。本地源码开发见[方案一:本地路径安装](docs/插件发布/方案一本地路径安装.zh.md)。
|
|
27
39
|
|
|
40
|
+
## 使用前提
|
|
41
|
+
|
|
42
|
+
使用本插件前,本机 Zotero 需备好两件事:**集成 MCP 插件**与**本地 API**。
|
|
43
|
+
|
|
44
|
+
### 1. 安装 Zotero MCP 插件
|
|
45
|
+
|
|
46
|
+
在 Zotero 的插件市场搜索 `mcp`,安装列表第一行、标签为 `ai` / `integration` 的 **Zotero MCP Plugin**(即 `zotero-integrated-mcp`)。装好后无需额外配置,默认监听 `http://127.0.0.1:23120/mcp`。
|
|
47
|
+
|
|
48
|
+
[](docs/images/zotero-mcp-plugin-market.png)
|
|
49
|
+
|
|
50
|
+
<sub>上图为 Zotero 插件市场,第一行「Zotero MCP Plugin」已安装。</sub>
|
|
51
|
+
|
|
52
|
+
如果装的是**其他** MCP 插件,或它的监听地址 / 端口不是 23120,到 dsh「插件」面板展开 `dsh-plugin-zotero` → 「配置 dsh-plugin-zotero」,把 **MCP 设置 → `mcpUrl`** 改成实际端点(如 `http://127.0.0.1:<端口>/mcp`)并保存,即时生效,无需重启。字段说明见[插件页配置项](#插件页配置项)。
|
|
53
|
+
|
|
54
|
+
> 没装 MCP 插件不影响右侧面板使用,只是模型侧 `mcp__zotero__*` 工具不可用。
|
|
55
|
+
|
|
56
|
+
### 2. 开启 Zotero 本地 API
|
|
57
|
+
|
|
58
|
+
Zotero → 设置 → 高级 → 勾选 **「允许此计算机上的其他应用程序与 Zotero 通信」**(默认端口 23119,仅监听回环)。
|
|
59
|
+
|
|
60
|
+
[](docs/images/zotero-allow-communication.png)
|
|
61
|
+
|
|
62
|
+
<sub>上图为 Zotero「设置 → 高级」中开启本地 API 的开关。</sub>
|
|
63
|
+
|
|
64
|
+
验证:
|
|
65
|
+
|
|
66
|
+
```sh
|
|
67
|
+
curl http://127.0.0.1:23119/api/ # 期望输出:Zotero is running
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
未勾选时读端点返回 403,面板显示「Zotero 未连接」并提示启用步骤。
|
|
71
|
+
|
|
28
72
|
## 特性
|
|
29
73
|
|
|
30
74
|
- **右侧栏面板「Zotero 文献库」**:顶部状态栏(Zotero / 模型工具探活)+ 左侧分类树(按需拉取、标题摘要搜索)+ 右侧条目详情或分类概要。
|
|
75
|
+
- **详情区上下分区**:上方正文区展示标题、元数据、摘要与 PDF 全文;下方用 tab 切换「参考文献 / 笔记 / 附件」。两个区域之间的分隔条可拖动,正文占比默认 85% 并按会话记住;没有次级内容的条目正文独占整栏。
|
|
76
|
+
- **摘要默认折叠**:标题行右侧的箭头按钮展开 / 收起摘要,默认把空间留给正文与全文。
|
|
77
|
+
- **笔记可读**:笔记以折叠列表呈现(默认收起,点击标题展开),正文保留 Zotero 的引用块、标注高亮、表格与外链图片;Host 侧已清洗脚本与事件属性,避免注入。
|
|
31
78
|
- **三种插入方式**:单条目引用、全文划词摘录、整目录引用,均只写进会话草稿(不自动发送、不抢焦点),文本携带 `itemKey` / `collectionKey` 供模型接续操作。
|
|
32
79
|
- **面板严格只读**:不提供任何新建 / 改名 / 删除分类的按钮。
|
|
33
80
|
- **模型侧工具可逐个开关**:插件自持连接集成 MCP,把工具以 `mcp__zotero__*` 注册进 dsh,可在插件页按工具启用 / 禁用。
|
|
@@ -66,6 +113,17 @@ MCP 组下方是 **「MCP 工具」** 区:现场列出集成 MCP 的全部工
|
|
|
66
113
|
|
|
67
114
|
## 架构
|
|
68
115
|
|
|
116
|
+
从使用者视角看,插件分两半,职责不重叠、互不依赖:
|
|
117
|
+
|
|
118
|
+
| 半边 | 能力 | 通道 |
|
|
119
|
+
|---|---|---|
|
|
120
|
+
| **人侧面板** | 在 DSH 右侧栏只读浏览 Zotero 文库(分类树 / 搜索 / 条目详情 / 笔记 / PDF 全文),把条目、摘录或整目录引用写进会话草稿 | 插件在宿主 web server 自注册的 `/dsh-zotero/api/*` 路由 |
|
|
121
|
+
| **模型侧** | 检索、精读、按需操作文库 | 插件**自持**连接本机 Zotero 集成 MCP,工具以 `mcp__zotero__*` 注册给模型 |
|
|
122
|
+
|
|
123
|
+
MCP 没起,面板照常可用;Zotero 没开,模型工具自然也不可用。
|
|
124
|
+
|
|
125
|
+
代码分布:
|
|
126
|
+
|
|
69
127
|
| 半边 | 代码位置 | 通道 |
|
|
70
128
|
|---|---|---|
|
|
71
129
|
| Host | `src/index.ts`、`src/host/`、`src/zotero/` | 把 Zotero 本地 API 包装成只读 HTTP 端点,挂在 DSH 宿主 web server 上 |
|
|
@@ -81,6 +139,7 @@ MCP 组下方是 **「MCP 工具」** 区:现场列出集成 MCP 的全部工
|
|
|
81
139
|
- Host 路由为 `GET /dsh-zotero/api/<action>`,action 有 `health` / `tree` / `items` / `item` / `collection-bib` / `mcp-tools`。
|
|
82
140
|
- Host 侧带信任栅栏:仅接受 GET,拒绝 `sec-fetch-site: cross-site`,且 `Host` 必须是回环地址(防 DNS rebinding)。
|
|
83
141
|
- 响应统一信封 `{ok:true,data}` / `{ok:false,error:{code,message}}`,错误码见 [src/zotero/types.ts](src/zotero/types.ts)。
|
|
142
|
+
- 条目详情里的笔记由 Host 侧从 `itemType: "note"` 子条目提取并清洗 HTML(剥离脚本、事件属性与冗余 `data-*`,图片限宽),Client 只负责折叠展示。
|
|
84
143
|
- 面板正文会被每个会话各挂一份,因此分类树 / 搜索词 / 选中项等状态放在 [src/client/paneStore.ts](src/client/paneStore.ts) 的模块级单例里,各会话看到的是同一块面板;右侧栏的展开状态与 tab 则**按会话**持久。
|
|
85
144
|
- 无会话时面板仍可通过右侧栏的 guide 入口(「Zotero 文献库」)打开。
|
|
86
145
|
|
|
@@ -93,7 +152,7 @@ src/ # 插件源码(主包,ESM / NodeNext / strict)
|
|
|
93
152
|
│ ├── router.ts # 只读 HTTP 路由 GET /dsh-zotero/api/<action>
|
|
94
153
|
│ └── mcp-bridge.ts # 自持集成 MCP 连接 + 按开关过滤注册模型工具
|
|
95
154
|
├── zotero/
|
|
96
|
-
│ ├── client.ts # Zotero 本地 API 客户端(只读)+ 集成 MCP JSON-RPC
|
|
155
|
+
│ ├── client.ts # Zotero 本地 API 客户端(只读)+ 笔记提取清洗 + 集成 MCP JSON-RPC
|
|
97
156
|
│ ├── config.ts # 端点 / 超时 / 截断阈值 + 运行时设置读取器
|
|
98
157
|
│ └── types.ts # Host ↔ Client 数据契约
|
|
99
158
|
└── client/ # Client 半(浏览器)
|
|
@@ -101,6 +160,9 @@ src/ # 插件源码(主包,ESM / NodeNext / strict)
|
|
|
101
160
|
├── ZoteroCard.tsx # 插件页配置卡(API 设置 / MCP 设置 / 工具开关)
|
|
102
161
|
├── ZoteroPane.tsx # 面板容器:状态栏 + 分类树 + 详情
|
|
103
162
|
├── CollectionTree.tsx / ItemDetail.tsx
|
|
163
|
+
├── DetailTabs.tsx # 详情底部分区 tab(参考文献 / 笔记 / 附件)
|
|
164
|
+
├── NoteList.tsx # 笔记折叠列表与正文渲染
|
|
165
|
+
├── styles.ts # 分区小标题 / 展开按钮等共用样式
|
|
104
166
|
├── paneStore.ts # 跨会话共享的面板状态
|
|
105
167
|
├── inline.ts # 往会话草稿插入文本
|
|
106
168
|
├── compose.ts # 插入文本模板
|
|
@@ -122,8 +184,8 @@ plugin_helloword/ # 官方插件示例(学习用,勿放正式代码
|
|
|
122
184
|
|
|
123
185
|
- Node + **pnpm**(主包与 `tstest/` 统一用 pnpm,勿与 npm / yarn 混用)。
|
|
124
186
|
- **TypeScript ^5.9**:`tsdown@0.22.0` 的 peer 依赖不支持 TypeScript 7.x。
|
|
125
|
-
- Zotero 桌面版已运行,且已开启本地 API
|
|
126
|
-
-
|
|
187
|
+
- Zotero 桌面版已运行,且已开启本地 API(见[使用前提](#使用前提))。
|
|
188
|
+
- **模型侧必需**:Zotero 已安装集成 MCP 插件(插件市场中的 **Zotero MCP Plugin** / `zotero-integrated-mcp`),监听 23120——若用其他 MCP 插件或端口不同,需在插件配置卡改 `mcpUrl`;并在 MCP 插件设置中**开启「允许写操作」**。只装插件不开写操作时,模型侧读类工具照常,但让模型新建 / 修改分类会直接报错(插件返回「写操作已禁用」)。详见[模型侧 MCP 与权限边界](#模型侧-mcp-与权限边界)。
|
|
127
189
|
- `dsh` CLI 可用。
|
|
128
190
|
|
|
129
191
|
## 构建
|
|
@@ -163,18 +225,14 @@ dsh --profile demo # 启动
|
|
|
163
225
|
|
|
164
226
|
### 开启 Zotero 本地 API
|
|
165
227
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
```sh
|
|
169
|
-
curl http://127.0.0.1:23119/api/ # 期望输出:Zotero is running
|
|
170
|
-
```
|
|
171
|
-
|
|
172
|
-
未勾选时读端点返回 403,面板显示「Zotero 未连接」并提示启用步骤。
|
|
228
|
+
见[使用前提 → 开启 Zotero 本地 API](#2-开启-zotero-本地-api)。未勾选时读端点返回 403,面板显示「Zotero 未连接」并提示启用步骤。
|
|
173
229
|
|
|
174
230
|
### 模型侧 MCP 与权限边界
|
|
175
231
|
|
|
176
232
|
模型侧工具由**插件自己**桥接:[src/host/mcp-bridge.ts](src/host/mcp-bridge.ts) 直连本机 Zotero 集成 MCP(本机实测 `zotero-integrated-mcp v1.1.0`,暴露 20 个工具),按配置里的 `disabledMcpTools` 过滤后以 `mcp__zotero__*` 注册给模型。[cordis.patch.yml](cordis.patch.yml) **不再**插入 `@deepseek-ai/dsh-mcp-client` —— 它不支持按工具开关,且同 `serverName` 会与自注册工具重名冲突。
|
|
177
233
|
|
|
234
|
+
⚠️ 前提是 [Zotero 里已装好集成 MCP 插件](#1-安装-zotero-mcp-插件)(或改用其他 MCP 插件并在配置卡填对 `mcpUrl`),并且开启了「允许写操作」。插件未安装或服务未起时,模型侧工具全部不可用;插件装了但没开写操作时,读类工具正常,`create_collection` 等写工具会被插件拒绝(返回「写操作已禁用」),表现为让模型帮忙新建分类直接报错——此时到 MCP 插件设置里打开写操作并重试即可,无需重启 dsh。
|
|
235
|
+
|
|
178
236
|
⚠️ 面板只读,**但模型侧工具不是**:20 个工具中含 5 个改变文库结构的写工具(`create_collection` / `update_collection` / `delete_collection` / `add_items_to_collection` / `remove_items_from_collection`)。想收紧为纯只读,直接在插件页配置卡的「MCP 工具」里关掉它们并保存即可;面板功能不受影响。
|
|
179
237
|
|
|
180
238
|
## 相关文档
|
package/client/client.js
CHANGED
|
@@ -48,8 +48,12 @@ const dicts = {
|
|
|
48
48
|
"detail.doi": "DOI",
|
|
49
49
|
"detail.url": "链接",
|
|
50
50
|
"detail.abstract": "摘要",
|
|
51
|
+
"detail.abstractExpand": "展开摘要",
|
|
52
|
+
"detail.abstractCollapse": "收起摘要",
|
|
51
53
|
"detail.tags": "标签",
|
|
52
54
|
"detail.attachments": "附件",
|
|
55
|
+
"detail.notes": "笔记",
|
|
56
|
+
"detail.noteTruncated": "(已按长度截断)",
|
|
53
57
|
"detail.fulltext": "全文",
|
|
54
58
|
"detail.noFulltext": "该附件没有可用的全文索引",
|
|
55
59
|
"detail.fulltextTruncated": "(已按长度截断)",
|
|
@@ -136,8 +140,12 @@ const dicts = {
|
|
|
136
140
|
"detail.doi": "DOI",
|
|
137
141
|
"detail.url": "URL",
|
|
138
142
|
"detail.abstract": "Abstract",
|
|
143
|
+
"detail.abstractExpand": "Expand abstract",
|
|
144
|
+
"detail.abstractCollapse": "Collapse abstract",
|
|
139
145
|
"detail.tags": "Tags",
|
|
140
146
|
"detail.attachments": "Attachments",
|
|
147
|
+
"detail.notes": "Notes",
|
|
148
|
+
"detail.noteTruncated": "(truncated by length)",
|
|
141
149
|
"detail.fulltext": "Full text",
|
|
142
150
|
"detail.noFulltext": "No full-text index available for this attachment",
|
|
143
151
|
"detail.fulltextTruncated": "(truncated by length)",
|
|
@@ -265,8 +273,12 @@ function fetchCollectionBib(key, style = "apa") {
|
|
|
265
273
|
const SEARCH_DEBOUNCE_MS = 250;
|
|
266
274
|
/** 搜索结果条数上限。 */
|
|
267
275
|
const SEARCH_LIMIT = 100;
|
|
276
|
+
/** 分类树每个节点一次最多拉取的条目数。 */
|
|
277
|
+
const NODE_LIMIT = 200;
|
|
268
278
|
/** 提示条停留时长。 */
|
|
269
279
|
const TOAST_MS = 3e3;
|
|
280
|
+
/** 文库根节点的 id(只存在于客户端,不对应任何 Zotero 分类)。 */
|
|
281
|
+
const TREE_ROOT_ID = "__library__";
|
|
270
282
|
function initialState() {
|
|
271
283
|
return {
|
|
272
284
|
health: null,
|
|
@@ -275,6 +287,9 @@ function initialState() {
|
|
|
275
287
|
treeError: null,
|
|
276
288
|
treeLoading: true,
|
|
277
289
|
loaded: false,
|
|
290
|
+
expanded: /* @__PURE__ */ new Set([TREE_ROOT_ID]),
|
|
291
|
+
nodeItems: {},
|
|
292
|
+
nodeTotals: {},
|
|
278
293
|
query: "",
|
|
279
294
|
results: null,
|
|
280
295
|
selectedItemKey: null,
|
|
@@ -291,6 +306,7 @@ function errorMessage(error) {
|
|
|
291
306
|
let state = initialState();
|
|
292
307
|
const listeners = /* @__PURE__ */ new Set();
|
|
293
308
|
let treeInflight = null;
|
|
309
|
+
const nodeInflight = /* @__PURE__ */ new Set();
|
|
294
310
|
let searchTimer = null;
|
|
295
311
|
let toastTimer = null;
|
|
296
312
|
function patch(next) {
|
|
@@ -349,6 +365,53 @@ function loadTree(force = false) {
|
|
|
349
365
|
treeInflight = run;
|
|
350
366
|
return run;
|
|
351
367
|
}
|
|
368
|
+
/** 按需拉取某节点的条目;已拉取或正在拉取时直接返回。 */
|
|
369
|
+
function loadNodeItems(nodeId, target) {
|
|
370
|
+
if (state.nodeItems[nodeId] !== void 0 || nodeInflight.has(nodeId)) return;
|
|
371
|
+
nodeInflight.add(nodeId);
|
|
372
|
+
fetchItems({
|
|
373
|
+
...target,
|
|
374
|
+
limit: NODE_LIMIT
|
|
375
|
+
}).then((data) => {
|
|
376
|
+
patch({
|
|
377
|
+
nodeItems: {
|
|
378
|
+
...state.nodeItems,
|
|
379
|
+
[nodeId]: data.items
|
|
380
|
+
},
|
|
381
|
+
nodeTotals: {
|
|
382
|
+
...state.nodeTotals,
|
|
383
|
+
[nodeId]: data.total
|
|
384
|
+
}
|
|
385
|
+
});
|
|
386
|
+
}).catch(() => {
|
|
387
|
+
patch({
|
|
388
|
+
nodeItems: {
|
|
389
|
+
...state.nodeItems,
|
|
390
|
+
[nodeId]: []
|
|
391
|
+
},
|
|
392
|
+
nodeTotals: {
|
|
393
|
+
...state.nodeTotals,
|
|
394
|
+
[nodeId]: 0
|
|
395
|
+
}
|
|
396
|
+
});
|
|
397
|
+
}).finally(() => {
|
|
398
|
+
nodeInflight.delete(nodeId);
|
|
399
|
+
});
|
|
400
|
+
}
|
|
401
|
+
/** 三角箭头:只开合节点,展开时按需拉取条目(根节点没有条目,不传 target)。 */
|
|
402
|
+
function toggleTreeNode(nodeId, target) {
|
|
403
|
+
const willOpen = !state.expanded.has(nodeId);
|
|
404
|
+
const expanded = new Set(state.expanded);
|
|
405
|
+
if (willOpen) expanded.add(nodeId);
|
|
406
|
+
else expanded.delete(nodeId);
|
|
407
|
+
patch({ expanded });
|
|
408
|
+
if (willOpen && target !== void 0) loadNodeItems(nodeId, target);
|
|
409
|
+
}
|
|
410
|
+
/** 选中分类时调用:确保节点展开且条目已拉取。 */
|
|
411
|
+
function expandTreeNode(nodeId, target) {
|
|
412
|
+
if (!state.expanded.has(nodeId)) patch({ expanded: new Set(state.expanded).add(nodeId) });
|
|
413
|
+
loadNodeItems(nodeId, target);
|
|
414
|
+
}
|
|
352
415
|
/** 更新搜索词并按防抖取数;清空时回到分类树。 */
|
|
353
416
|
function setQuery(next) {
|
|
354
417
|
patch({ query: next });
|
|
@@ -402,6 +465,7 @@ function resetPaneStore() {
|
|
|
402
465
|
searchTimer = null;
|
|
403
466
|
toastTimer = null;
|
|
404
467
|
treeInflight = null;
|
|
468
|
+
nodeInflight.clear();
|
|
405
469
|
state = initialState();
|
|
406
470
|
for (const listener of listeners) listener();
|
|
407
471
|
}
|
|
@@ -730,10 +794,9 @@ function ZoteroCard(props) {
|
|
|
730
794
|
* - 「我的文库」根节点**不再平铺全库条目**(这些条目本就挂在各分类下,平铺会造成重复);
|
|
731
795
|
* 其下额外挂三个虚拟分类:我的出版物 / 未分类条目 / 回收站,与 Zotero 左侧栏一致。
|
|
732
796
|
* - 分类 / 条目右键 → 「添加到会话」。
|
|
797
|
+
* - 展开集合与各节点条目都放在 {@link paneStore}:右侧栏切 tab 时面板正文会被卸载
|
|
798
|
+
* 重挂,局部 state 会丢,只有模块级 store 能让树保持原样。
|
|
733
799
|
*/
|
|
734
|
-
/** 每个节点一次最多拉取的条目数。 */
|
|
735
|
-
const NODE_LIMIT = 200;
|
|
736
|
-
const ROOT_NODE = "__library__";
|
|
737
800
|
/** 每层缩进量(px)。 */
|
|
738
801
|
const INDENT = 14;
|
|
739
802
|
/** 树左起始留白(px)。 */
|
|
@@ -1067,50 +1130,14 @@ function VirtualRows({ ctx, node, depth }) {
|
|
|
1067
1130
|
}
|
|
1068
1131
|
function CollectionTree(props) {
|
|
1069
1132
|
const { t, collections, selectedItemKey, selectedCollectionKey, onSelectItem, onSelectCollection, onInsertItem, onInsertCollection } = props;
|
|
1070
|
-
/**
|
|
1071
|
-
const
|
|
1072
|
-
const [itemsByNode, setItemsByNode] = (0, react.useState)({});
|
|
1073
|
-
const [totalsByNode, setTotalsByNode] = (0, react.useState)({});
|
|
1074
|
-
async function load(nodeId, opts = {}) {
|
|
1075
|
-
if (itemsByNode[nodeId] !== void 0) return;
|
|
1076
|
-
try {
|
|
1077
|
-
const data = await fetchItems({
|
|
1078
|
-
...opts,
|
|
1079
|
-
limit: NODE_LIMIT
|
|
1080
|
-
});
|
|
1081
|
-
setItemsByNode((prev) => ({
|
|
1082
|
-
...prev,
|
|
1083
|
-
[nodeId]: data.items
|
|
1084
|
-
}));
|
|
1085
|
-
setTotalsByNode((prev) => ({
|
|
1086
|
-
...prev,
|
|
1087
|
-
[nodeId]: data.total
|
|
1088
|
-
}));
|
|
1089
|
-
} catch {
|
|
1090
|
-
setItemsByNode((prev) => ({
|
|
1091
|
-
...prev,
|
|
1092
|
-
[nodeId]: []
|
|
1093
|
-
}));
|
|
1094
|
-
setTotalsByNode((prev) => ({
|
|
1095
|
-
...prev,
|
|
1096
|
-
[nodeId]: 0
|
|
1097
|
-
}));
|
|
1098
|
-
}
|
|
1099
|
-
}
|
|
1133
|
+
/** 展开集合与各节点条目都在 store 里(默认展开根节点),重挂面板后原样恢复。 */
|
|
1134
|
+
const { expanded, nodeItems, nodeTotals } = usePaneState();
|
|
1100
1135
|
/** 按需拉取:条目一律由 toggle / select 触发,根节点不再预取全库条目。 */
|
|
1101
1136
|
function open(nodeId, collection) {
|
|
1102
|
-
|
|
1103
|
-
load(nodeId, loadOpts(collection));
|
|
1137
|
+
expandTreeNode(nodeId, loadOpts(collection));
|
|
1104
1138
|
}
|
|
1105
1139
|
function toggle(nodeId, collection) {
|
|
1106
|
-
|
|
1107
|
-
setExpanded((prev) => {
|
|
1108
|
-
const next = new Set(prev);
|
|
1109
|
-
if (willOpen) next.add(nodeId);
|
|
1110
|
-
else next.delete(nodeId);
|
|
1111
|
-
return next;
|
|
1112
|
-
});
|
|
1113
|
-
if (willOpen && collection !== void 0) load(nodeId, loadOpts(collection));
|
|
1140
|
+
toggleTreeNode(nodeId, collection === void 0 ? void 0 : loadOpts(collection));
|
|
1114
1141
|
}
|
|
1115
1142
|
function select(collection) {
|
|
1116
1143
|
onSelectCollection(collection);
|
|
@@ -1119,8 +1146,8 @@ function CollectionTree(props) {
|
|
|
1119
1146
|
const ctx = {
|
|
1120
1147
|
t,
|
|
1121
1148
|
expanded,
|
|
1122
|
-
itemsByNode,
|
|
1123
|
-
totalsByNode,
|
|
1149
|
+
itemsByNode: nodeItems,
|
|
1150
|
+
totalsByNode: nodeTotals,
|
|
1124
1151
|
selectedItemKey,
|
|
1125
1152
|
selectedCollectionKey,
|
|
1126
1153
|
toggle,
|
|
@@ -1129,7 +1156,7 @@ function CollectionTree(props) {
|
|
|
1129
1156
|
onInsertItem,
|
|
1130
1157
|
onInsertCollection
|
|
1131
1158
|
};
|
|
1132
|
-
const rootOpen = expanded.has(
|
|
1159
|
+
const rootOpen = expanded.has(TREE_ROOT_ID);
|
|
1133
1160
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1134
1161
|
style: {
|
|
1135
1162
|
padding: "8px 6px",
|
|
@@ -1137,7 +1164,7 @@ function CollectionTree(props) {
|
|
|
1137
1164
|
flexDirection: "column"
|
|
1138
1165
|
},
|
|
1139
1166
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1140
|
-
onClick: () => toggle(
|
|
1167
|
+
onClick: () => toggle(TREE_ROOT_ID),
|
|
1141
1168
|
style: {
|
|
1142
1169
|
...rowStyle,
|
|
1143
1170
|
...rowIndent(0)
|
|
@@ -1145,7 +1172,7 @@ function CollectionTree(props) {
|
|
|
1145
1172
|
children: [
|
|
1146
1173
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Chevron, {
|
|
1147
1174
|
open: rootOpen,
|
|
1148
|
-
onToggle: () => toggle(
|
|
1175
|
+
onToggle: () => toggle(TREE_ROOT_ID)
|
|
1149
1176
|
}),
|
|
1150
1177
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1151
1178
|
style: iconBox,
|
|
@@ -1229,25 +1256,260 @@ async function insertBuilt(actions, build) {
|
|
|
1229
1256
|
return actions.insertText(text, span) ? "inserted" : "draft-changed";
|
|
1230
1257
|
}
|
|
1231
1258
|
//#endregion
|
|
1259
|
+
//#region src/client/styles.ts
|
|
1260
|
+
/**
|
|
1261
|
+
* 右栏共用样式。
|
|
1262
|
+
*
|
|
1263
|
+
* 小标题(摘要 / 全文 / 参考文献 / 附件 / 笔记)统一用 {@link sectionTitleStyle}:
|
|
1264
|
+
* 蓝色、加粗、字号略大,方便在密集的元数据里一眼识别分区。
|
|
1265
|
+
*/
|
|
1266
|
+
/** 蓝色高亮色(与分隔条 hover 蓝一致)。 */
|
|
1267
|
+
const ACCENT = "#508cff";
|
|
1268
|
+
/** 分区小标题。 */
|
|
1269
|
+
const sectionTitleStyle = {
|
|
1270
|
+
margin: "0 0 6px",
|
|
1271
|
+
fontSize: 13,
|
|
1272
|
+
fontWeight: 700,
|
|
1273
|
+
color: ACCENT,
|
|
1274
|
+
letterSpacing: .2
|
|
1275
|
+
};
|
|
1276
|
+
/** 可点击的小标题行(带展开/收起箭头)。 */
|
|
1277
|
+
const sectionToggleRowStyle = {
|
|
1278
|
+
display: "flex",
|
|
1279
|
+
alignItems: "center",
|
|
1280
|
+
gap: 6,
|
|
1281
|
+
margin: "0 0 6px"
|
|
1282
|
+
};
|
|
1283
|
+
/** 展开/收起箭头按钮。 */
|
|
1284
|
+
const sectionToggleButtonStyle = {
|
|
1285
|
+
display: "inline-flex",
|
|
1286
|
+
alignItems: "center",
|
|
1287
|
+
justifyContent: "center",
|
|
1288
|
+
width: 20,
|
|
1289
|
+
height: 20,
|
|
1290
|
+
padding: 0,
|
|
1291
|
+
fontSize: 11,
|
|
1292
|
+
lineHeight: 1,
|
|
1293
|
+
color: ACCENT,
|
|
1294
|
+
background: "transparent",
|
|
1295
|
+
border: "1px solid rgba(80,140,255,0.4)",
|
|
1296
|
+
borderRadius: 5,
|
|
1297
|
+
cursor: "pointer"
|
|
1298
|
+
};
|
|
1299
|
+
//#endregion
|
|
1300
|
+
//#region src/client/DetailTabs.tsx
|
|
1301
|
+
/**
|
|
1302
|
+
* 右栏底部:可切换的分区面板(tab 页)。
|
|
1303
|
+
*
|
|
1304
|
+
* 用于承载「参考文献 / 笔记 / 附件」这类次级内容:它们与正文区(标题、元数据、
|
|
1305
|
+
* 摘要、全文)分开,用 tab 切换,避免正文区被撑散、也方便后续往这里加新的分区。
|
|
1306
|
+
*
|
|
1307
|
+
* 传入的 tabs 里没有内容的分区不会被渲染成 tab;默认选中第一个有内容的分区。
|
|
1308
|
+
*/
|
|
1309
|
+
function DetailTabs({ tabs }) {
|
|
1310
|
+
const [activeId, setActiveId] = (0, react.useState)("");
|
|
1311
|
+
if (tabs.length === 0) return null;
|
|
1312
|
+
const active = tabs.find((tab) => tab.id === activeId) ?? tabs[0];
|
|
1313
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1314
|
+
style: {
|
|
1315
|
+
display: "flex",
|
|
1316
|
+
flexDirection: "column",
|
|
1317
|
+
minHeight: 0,
|
|
1318
|
+
height: "100%"
|
|
1319
|
+
},
|
|
1320
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1321
|
+
role: "tablist",
|
|
1322
|
+
style: tabBarStyle,
|
|
1323
|
+
children: tabs.map((tab) => {
|
|
1324
|
+
const selected = tab.id === active.id;
|
|
1325
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
1326
|
+
type: "button",
|
|
1327
|
+
role: "tab",
|
|
1328
|
+
"aria-selected": selected,
|
|
1329
|
+
onClick: () => setActiveId(tab.id),
|
|
1330
|
+
style: tabButtonStyle(selected),
|
|
1331
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: tab.label }), tab.hint !== void 0 && tab.hint !== "" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1332
|
+
style: {
|
|
1333
|
+
opacity: .55,
|
|
1334
|
+
fontWeight: 400,
|
|
1335
|
+
fontSize: 11
|
|
1336
|
+
},
|
|
1337
|
+
children: tab.hint
|
|
1338
|
+
})]
|
|
1339
|
+
}, tab.id);
|
|
1340
|
+
})
|
|
1341
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1342
|
+
role: "tabpanel",
|
|
1343
|
+
style: {
|
|
1344
|
+
flex: 1,
|
|
1345
|
+
minHeight: 0,
|
|
1346
|
+
overflow: "auto",
|
|
1347
|
+
padding: "10px 14px 12px"
|
|
1348
|
+
},
|
|
1349
|
+
children: active.content
|
|
1350
|
+
})]
|
|
1351
|
+
});
|
|
1352
|
+
}
|
|
1353
|
+
const tabBarStyle = {
|
|
1354
|
+
display: "flex",
|
|
1355
|
+
alignItems: "stretch",
|
|
1356
|
+
gap: 4,
|
|
1357
|
+
flexShrink: 0,
|
|
1358
|
+
padding: "0 10px",
|
|
1359
|
+
borderBottom: "1px solid rgba(127,127,127,0.22)"
|
|
1360
|
+
};
|
|
1361
|
+
function tabButtonStyle(selected) {
|
|
1362
|
+
return {
|
|
1363
|
+
display: "inline-flex",
|
|
1364
|
+
alignItems: "center",
|
|
1365
|
+
gap: 5,
|
|
1366
|
+
padding: "8px 10px 7px",
|
|
1367
|
+
marginBottom: -1,
|
|
1368
|
+
fontSize: 13,
|
|
1369
|
+
fontWeight: 700,
|
|
1370
|
+
letterSpacing: .2,
|
|
1371
|
+
color: ACCENT,
|
|
1372
|
+
opacity: selected ? 1 : .55,
|
|
1373
|
+
background: "transparent",
|
|
1374
|
+
border: "none",
|
|
1375
|
+
borderBottom: `2px solid ${selected ? ACCENT : "transparent"}`,
|
|
1376
|
+
cursor: "pointer"
|
|
1377
|
+
};
|
|
1378
|
+
}
|
|
1379
|
+
//#endregion
|
|
1380
|
+
//#region src/client/NoteList.tsx
|
|
1381
|
+
/**
|
|
1382
|
+
* 右栏:条目详情「笔记」tab 里的笔记列表。
|
|
1383
|
+
*
|
|
1384
|
+
* 笔记是 Zotero 的子条目(`itemType: "note"`),正文在 `data.note` 字段里,
|
|
1385
|
+
* 是带排版标签的 HTML(段落、引用、标注高亮、外链图片)。
|
|
1386
|
+
* Host 侧已完成清洗(剥离 `data-*` 冗余属性、脚本与事件属性、图片限宽),
|
|
1387
|
+
* 这里直接以 `dangerouslySetInnerHTML` 渲染。
|
|
1388
|
+
*
|
|
1389
|
+
* 每条笔记默认折叠成一行标题(正文首段摘要),点击标题展开正文。
|
|
1390
|
+
*/
|
|
1391
|
+
function NoteList({ t, notes }) {
|
|
1392
|
+
const [expanded, setExpanded] = (0, react.useState)(/* @__PURE__ */ new Set());
|
|
1393
|
+
if (notes.length === 0) return null;
|
|
1394
|
+
function toggle(key) {
|
|
1395
|
+
setExpanded((prev) => {
|
|
1396
|
+
const next = new Set(prev);
|
|
1397
|
+
if (next.has(key)) next.delete(key);
|
|
1398
|
+
else next.add(key);
|
|
1399
|
+
return next;
|
|
1400
|
+
});
|
|
1401
|
+
}
|
|
1402
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("style", { children: NOTE_CSS }), notes.map((note) => {
|
|
1403
|
+
const open = expanded.has(note.key);
|
|
1404
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1405
|
+
style: { marginBottom: 10 },
|
|
1406
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
1407
|
+
type: "button",
|
|
1408
|
+
onClick: () => toggle(note.key),
|
|
1409
|
+
style: noteHeaderStyle,
|
|
1410
|
+
children: [
|
|
1411
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1412
|
+
style: {
|
|
1413
|
+
flexShrink: 0,
|
|
1414
|
+
opacity: .55
|
|
1415
|
+
},
|
|
1416
|
+
children: open ? "▾" : "▸"
|
|
1417
|
+
}),
|
|
1418
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1419
|
+
style: {
|
|
1420
|
+
flex: 1,
|
|
1421
|
+
textAlign: "left",
|
|
1422
|
+
wordBreak: "break-word"
|
|
1423
|
+
},
|
|
1424
|
+
children: note.title
|
|
1425
|
+
}),
|
|
1426
|
+
note.truncated && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1427
|
+
style: {
|
|
1428
|
+
opacity: .55,
|
|
1429
|
+
flexShrink: 0
|
|
1430
|
+
},
|
|
1431
|
+
children: t("detail.noteTruncated")
|
|
1432
|
+
})
|
|
1433
|
+
]
|
|
1434
|
+
}), open && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1435
|
+
className: "dsh-zotero-note",
|
|
1436
|
+
dangerouslySetInnerHTML: { __html: note.html },
|
|
1437
|
+
style: noteBodyStyle
|
|
1438
|
+
})]
|
|
1439
|
+
}, note.key);
|
|
1440
|
+
})] });
|
|
1441
|
+
}
|
|
1442
|
+
/**
|
|
1443
|
+
* 笔记正文里的样式。
|
|
1444
|
+
*
|
|
1445
|
+
* 笔记 HTML 由 Zotero 生成,段落/引用/高亮标记都是默认样式,这里补一套
|
|
1446
|
+
* 贴合右栏密度的排版(引用块、标注高亮、图片、表格)。
|
|
1447
|
+
*/
|
|
1448
|
+
const NOTE_CSS = `
|
|
1449
|
+
.dsh-zotero-note p { margin: 0 0 6px; }
|
|
1450
|
+
.dsh-zotero-note p:last-child { margin-bottom: 0; }
|
|
1451
|
+
.dsh-zotero-note blockquote {
|
|
1452
|
+
margin: 6px 0;
|
|
1453
|
+
padding-left: 8px;
|
|
1454
|
+
border-left: 3px solid rgba(127,127,127,0.3);
|
|
1455
|
+
opacity: 0.85;
|
|
1456
|
+
}
|
|
1457
|
+
.dsh-zotero-note .highlight {
|
|
1458
|
+
background: rgba(255, 213, 79, 0.28);
|
|
1459
|
+
border-radius: 2px;
|
|
1460
|
+
}
|
|
1461
|
+
.dsh-zotero-note .citation { opacity: 0.75; font-style: italic; }
|
|
1462
|
+
.dsh-zotero-note img { max-width: 100%; height: auto; border-radius: 4px; }
|
|
1463
|
+
.dsh-zotero-note figure { margin: 6px 0; }
|
|
1464
|
+
.dsh-zotero-note table { border-collapse: collapse; max-width: 100%; }
|
|
1465
|
+
.dsh-zotero-note td, .dsh-zotero-note th { border: 1px solid rgba(127,127,127,0.25); padding: 3px 6px; }
|
|
1466
|
+
`;
|
|
1467
|
+
const noteHeaderStyle = {
|
|
1468
|
+
display: "flex",
|
|
1469
|
+
gap: 6,
|
|
1470
|
+
alignItems: "baseline",
|
|
1471
|
+
width: "100%",
|
|
1472
|
+
padding: "4px 2px",
|
|
1473
|
+
fontSize: 12.5,
|
|
1474
|
+
lineHeight: 1.6,
|
|
1475
|
+
background: "transparent",
|
|
1476
|
+
border: "none",
|
|
1477
|
+
borderBottom: "1px solid rgba(127,127,127,0.18)",
|
|
1478
|
+
color: "inherit",
|
|
1479
|
+
cursor: "pointer"
|
|
1480
|
+
};
|
|
1481
|
+
const noteBodyStyle = {
|
|
1482
|
+
marginTop: 6,
|
|
1483
|
+
padding: "6px 8px",
|
|
1484
|
+
border: "1px solid rgba(127,127,127,0.25)",
|
|
1485
|
+
borderRadius: 6,
|
|
1486
|
+
fontSize: 12.5,
|
|
1487
|
+
lineHeight: 1.75,
|
|
1488
|
+
opacity: .9,
|
|
1489
|
+
overflowWrap: "break-word"
|
|
1490
|
+
};
|
|
1491
|
+
//#endregion
|
|
1232
1492
|
//#region src/client/ItemDetail.tsx
|
|
1233
1493
|
/**
|
|
1234
1494
|
* 右栏:单条条目详情。
|
|
1235
1495
|
*
|
|
1236
|
-
*
|
|
1237
|
-
*
|
|
1238
|
-
*
|
|
1496
|
+
* 版面分上下两区:上方「正文区」(标题 / 元数据 / 摘要 / 全文块),下方「分区面板区」
|
|
1497
|
+
* (参考文献 / 笔记 / 附件,用 tab 切换)。两区之间是可拖动的横向分隔条,默认正文占
|
|
1498
|
+
* 85%,占比存 localStorage 跨会话记住;底部没有任何分区时不分区,正文独占整栏。
|
|
1239
1499
|
*
|
|
1240
|
-
* 正文区内部再分两块:头部信息(标题 / 元数据 /
|
|
1241
|
-
*
|
|
1500
|
+
* 正文区内部再分两块:头部信息(标题 / 元数据 / 摘要,过高时自己滚动)与全文块
|
|
1501
|
+
* (撑满剩余高度、自己滚动),所以拖高正文区时全文文本跟着变高。
|
|
1502
|
+
*
|
|
1503
|
+
* 摘要默认折叠,标题行右侧的箭头按钮展开 / 收起。
|
|
1242
1504
|
*
|
|
1243
1505
|
* 「添加到会话」两处入口:头部按钮(整条目元数据)、全文块里的选区浮出按钮
|
|
1244
1506
|
* (摘录)。全文块内用鼠标选中文本后浮出小按钮,位置取选区 rect。
|
|
1245
1507
|
*/
|
|
1246
1508
|
/** 正文区占比的存储键与取值范围(%)。 */
|
|
1247
1509
|
const BODY_PERCENT_KEY = "dsh-plugin-zotero.detailBodyPercent";
|
|
1248
|
-
const BODY_PERCENT_DEFAULT =
|
|
1510
|
+
const BODY_PERCENT_DEFAULT = 85;
|
|
1249
1511
|
const BODY_PERCENT_MIN = 30;
|
|
1250
|
-
const BODY_PERCENT_MAX =
|
|
1512
|
+
const BODY_PERCENT_MAX = 95;
|
|
1251
1513
|
function readBodyPercent() {
|
|
1252
1514
|
try {
|
|
1253
1515
|
const value = Number.parseInt(window.localStorage.getItem(BODY_PERCENT_KEY) ?? "", 10);
|
|
@@ -1287,11 +1549,61 @@ function ItemDetail({ t, detail, onInsertItem, onInsertExcerpt, onOpenItem }) {
|
|
|
1287
1549
|
const [selection, setSelection] = (0, react.useState)(null);
|
|
1288
1550
|
const [bodyPercent, setBodyPercent] = (0, react.useState)(readBodyPercent);
|
|
1289
1551
|
const [splitHover, setSplitHover] = (0, react.useState)(false);
|
|
1552
|
+
const [abstractOpen, setAbstractOpen] = (0, react.useState)(false);
|
|
1290
1553
|
const boxRef = (0, react.useRef)(null);
|
|
1291
1554
|
const rootRef = (0, react.useRef)(null);
|
|
1292
1555
|
const dragRef = (0, react.useRef)(null);
|
|
1293
1556
|
const bib = detail.bib;
|
|
1294
1557
|
const fulltext = detail.fulltext;
|
|
1558
|
+
const tabs = [];
|
|
1559
|
+
if (bib !== null) tabs.push({
|
|
1560
|
+
id: "bib",
|
|
1561
|
+
label: t("detail.bibTitle"),
|
|
1562
|
+
content: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
1563
|
+
style: {
|
|
1564
|
+
margin: 0,
|
|
1565
|
+
opacity: .85,
|
|
1566
|
+
fontSize: 12.5,
|
|
1567
|
+
lineHeight: 1.7,
|
|
1568
|
+
whiteSpace: "pre-wrap"
|
|
1569
|
+
},
|
|
1570
|
+
children: stripTags$1(bib)
|
|
1571
|
+
})
|
|
1572
|
+
});
|
|
1573
|
+
if (detail.notes.length > 0) tabs.push({
|
|
1574
|
+
id: "notes",
|
|
1575
|
+
label: t("detail.notes"),
|
|
1576
|
+
hint: String(detail.notes.length),
|
|
1577
|
+
content: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NoteList, {
|
|
1578
|
+
t,
|
|
1579
|
+
notes: detail.notes
|
|
1580
|
+
})
|
|
1581
|
+
});
|
|
1582
|
+
if (detail.attachments.length > 0) tabs.push({
|
|
1583
|
+
id: "attachments",
|
|
1584
|
+
label: t("detail.attachments"),
|
|
1585
|
+
hint: String(detail.attachments.length),
|
|
1586
|
+
content: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { children: detail.attachments.map((attachment) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
1587
|
+
type: "button",
|
|
1588
|
+
onClick: () => onOpenItem(attachment.key),
|
|
1589
|
+
style: linkRowStyle,
|
|
1590
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1591
|
+
style: {
|
|
1592
|
+
flex: 1,
|
|
1593
|
+
textAlign: "left",
|
|
1594
|
+
wordBreak: "break-word"
|
|
1595
|
+
},
|
|
1596
|
+
children: attachment.title
|
|
1597
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
1598
|
+
style: {
|
|
1599
|
+
opacity: .55,
|
|
1600
|
+
flexShrink: 0
|
|
1601
|
+
},
|
|
1602
|
+
children: [attachment.contentType, attachment.size > 0 ? ` · ${Math.round(attachment.size / 1024)} KB` : ""]
|
|
1603
|
+
})]
|
|
1604
|
+
}, attachment.key)) })
|
|
1605
|
+
});
|
|
1606
|
+
const hasBottom = tabs.length > 0;
|
|
1295
1607
|
function clampBodyPercent(next) {
|
|
1296
1608
|
return Math.min(Math.max(next, BODY_PERCENT_MIN), BODY_PERCENT_MAX);
|
|
1297
1609
|
}
|
|
@@ -1349,7 +1661,7 @@ function ItemDetail({ t, detail, onInsertItem, onInsertExcerpt, onOpenItem }) {
|
|
|
1349
1661
|
children: [
|
|
1350
1662
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1351
1663
|
style: {
|
|
1352
|
-
flex:
|
|
1664
|
+
flex: hasBottom ? `0 0 ${bodyPercent}%` : "1 1 auto",
|
|
1353
1665
|
minHeight: 0,
|
|
1354
1666
|
display: "flex",
|
|
1355
1667
|
flexDirection: "column",
|
|
@@ -1411,45 +1723,37 @@ function ItemDetail({ t, detail, onInsertItem, onInsertExcerpt, onOpenItem }) {
|
|
|
1411
1723
|
children: detail.tags.join("、")
|
|
1412
1724
|
}),
|
|
1413
1725
|
detail.abstract !== "" && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
|
|
1414
|
-
style: {
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1726
|
+
style: {
|
|
1727
|
+
marginTop: 12,
|
|
1728
|
+
paddingBottom: 12
|
|
1729
|
+
},
|
|
1730
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1731
|
+
style: sectionToggleRowStyle,
|
|
1732
|
+
children: [
|
|
1733
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", {
|
|
1734
|
+
style: {
|
|
1735
|
+
...sectionTitleStyle,
|
|
1736
|
+
margin: 0
|
|
1737
|
+
},
|
|
1738
|
+
children: t("detail.abstract")
|
|
1739
|
+
}),
|
|
1740
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { style: { flex: 1 } }),
|
|
1741
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
1742
|
+
type: "button",
|
|
1743
|
+
onClick: () => setAbstractOpen((open) => !open),
|
|
1744
|
+
"aria-expanded": abstractOpen,
|
|
1745
|
+
"aria-label": abstractOpen ? t("detail.abstractCollapse") : t("detail.abstractExpand"),
|
|
1746
|
+
style: sectionToggleButtonStyle,
|
|
1747
|
+
children: abstractOpen ? "▴" : "▾"
|
|
1748
|
+
})
|
|
1749
|
+
]
|
|
1750
|
+
}), abstractOpen && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
1419
1751
|
style: {
|
|
1420
|
-
margin: 0,
|
|
1752
|
+
margin: "4px 0 0",
|
|
1421
1753
|
opacity: .85
|
|
1422
1754
|
},
|
|
1423
1755
|
children: detail.abstract
|
|
1424
1756
|
})]
|
|
1425
|
-
}),
|
|
1426
|
-
detail.attachments.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
|
|
1427
|
-
style: {
|
|
1428
|
-
marginTop: 14,
|
|
1429
|
-
paddingBottom: 14
|
|
1430
|
-
},
|
|
1431
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", {
|
|
1432
|
-
style: sectionTitle,
|
|
1433
|
-
children: t("detail.attachments")
|
|
1434
|
-
}), detail.attachments.map((attachment) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
1435
|
-
type: "button",
|
|
1436
|
-
onClick: () => onOpenItem(attachment.key),
|
|
1437
|
-
style: linkRowStyle,
|
|
1438
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1439
|
-
style: {
|
|
1440
|
-
flex: 1,
|
|
1441
|
-
textAlign: "left",
|
|
1442
|
-
wordBreak: "break-word"
|
|
1443
|
-
},
|
|
1444
|
-
children: attachment.title
|
|
1445
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
1446
|
-
style: {
|
|
1447
|
-
opacity: .55,
|
|
1448
|
-
flexShrink: 0
|
|
1449
|
-
},
|
|
1450
|
-
children: [attachment.contentType, attachment.size > 0 ? ` · ${Math.round(attachment.size / 1024)} KB` : ""]
|
|
1451
|
-
})]
|
|
1452
|
-
}, attachment.key))]
|
|
1453
1757
|
})
|
|
1454
1758
|
]
|
|
1455
1759
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
|
|
@@ -1461,7 +1765,7 @@ function ItemDetail({ t, detail, onInsertItem, onInsertExcerpt, onOpenItem }) {
|
|
|
1461
1765
|
padding: "2px 14px 14px"
|
|
1462
1766
|
},
|
|
1463
1767
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("h3", {
|
|
1464
|
-
style:
|
|
1768
|
+
style: sectionTitleStyle,
|
|
1465
1769
|
children: [t("detail.fulltext"), fulltext !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1466
1770
|
style: {
|
|
1467
1771
|
opacity: .55,
|
|
@@ -1529,7 +1833,7 @@ function ItemDetail({ t, detail, onInsertItem, onInsertExcerpt, onOpenItem }) {
|
|
|
1529
1833
|
})]
|
|
1530
1834
|
})]
|
|
1531
1835
|
}),
|
|
1532
|
-
|
|
1836
|
+
hasBottom && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1533
1837
|
role: "separator",
|
|
1534
1838
|
"aria-orientation": "horizontal",
|
|
1535
1839
|
onPointerDown: onSplitterDown,
|
|
@@ -1553,35 +1857,18 @@ function ItemDetail({ t, detail, onInsertItem, onInsertExcerpt, onOpenItem }) {
|
|
|
1553
1857
|
background: splitHover || dragRef.current !== null ? "rgba(80,140,255,0.75)" : "rgba(127,127,127,0.2)"
|
|
1554
1858
|
} })
|
|
1555
1859
|
}),
|
|
1556
|
-
|
|
1860
|
+
hasBottom && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1557
1861
|
style: {
|
|
1558
1862
|
flex: 1,
|
|
1559
1863
|
minHeight: 0,
|
|
1560
|
-
|
|
1561
|
-
|
|
1864
|
+
display: "flex",
|
|
1865
|
+
flexDirection: "column"
|
|
1562
1866
|
},
|
|
1563
|
-
children:
|
|
1564
|
-
style: sectionTitle,
|
|
1565
|
-
children: t("detail.bibTitle")
|
|
1566
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
1567
|
-
style: {
|
|
1568
|
-
margin: 0,
|
|
1569
|
-
opacity: .85,
|
|
1570
|
-
fontSize: 12.5,
|
|
1571
|
-
whiteSpace: "pre-wrap"
|
|
1572
|
-
},
|
|
1573
|
-
children: stripTags$1(bib)
|
|
1574
|
-
})]
|
|
1867
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DetailTabs, { tabs })
|
|
1575
1868
|
})
|
|
1576
1869
|
]
|
|
1577
1870
|
});
|
|
1578
1871
|
}
|
|
1579
|
-
const sectionTitle = {
|
|
1580
|
-
margin: "0 0 6px",
|
|
1581
|
-
fontSize: 12.5,
|
|
1582
|
-
fontWeight: 600,
|
|
1583
|
-
opacity: .75
|
|
1584
|
-
};
|
|
1585
1872
|
const linkRowStyle = {
|
|
1586
1873
|
display: "flex",
|
|
1587
1874
|
gap: 8,
|
|
@@ -1892,10 +2179,8 @@ function ZoteroPane({ t, inputActions }) {
|
|
|
1892
2179
|
}),
|
|
1893
2180
|
selectedCollection.scope === void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", {
|
|
1894
2181
|
style: {
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
fontWeight: 600,
|
|
1898
|
-
opacity: .75
|
|
2182
|
+
...sectionTitleStyle,
|
|
2183
|
+
margin: "16px 0 6px"
|
|
1899
2184
|
},
|
|
1900
2185
|
children: t("detail.bibTitle")
|
|
1901
2186
|
}), collectionBib === null ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
package/lib/zotero/client.d.ts
CHANGED
|
@@ -40,6 +40,9 @@ interface RawItemData {
|
|
|
40
40
|
collections?: string[];
|
|
41
41
|
contentType?: string;
|
|
42
42
|
filename?: string;
|
|
43
|
+
/** 笔记正文(HTML),仅 `itemType === 'note'` 有。 */
|
|
44
|
+
note?: string;
|
|
45
|
+
dateModified?: string;
|
|
43
46
|
}
|
|
44
47
|
interface RawEnclosure {
|
|
45
48
|
href?: string;
|
|
@@ -61,6 +64,8 @@ interface RawItem {
|
|
|
61
64
|
};
|
|
62
65
|
data?: RawItemData;
|
|
63
66
|
}
|
|
67
|
+
/** 清洗笔记正文 HTML。 */
|
|
68
|
+
export declare function sanitizeNoteHtml(html: string): string;
|
|
64
69
|
/** 探活 Zotero 本地 API,返回版本信息;不可达时 running=false。 */
|
|
65
70
|
export declare function probe(): Promise<ZoteroHealth['zotero']>;
|
|
66
71
|
/** 用 TCP 连接探活 Zotero 集成 MCP 端口(轻量、不建会话)。 */
|
|
@@ -104,7 +109,7 @@ export declare function getItemChildren(key: string): Promise<RawItem[]>;
|
|
|
104
109
|
export declare function getItemFulltext(attachmentKey: string): Promise<ZoteroFulltext | null>;
|
|
105
110
|
/** 单条条目的 CSL HTML(`format=bib`);失败返回 null。 */
|
|
106
111
|
export declare function getItemBib(key: string, style: string): Promise<string | null>;
|
|
107
|
-
/** 条目详情:元数据 + 附件 + 首个可读附件全文 + CSL。 */
|
|
112
|
+
/** 条目详情:元数据 + 附件 + 笔记 + 首个可读附件全文 + CSL。 */
|
|
108
113
|
export declare function getItemDetail(key: string, style: string): Promise<ZoteroItemDetail>;
|
|
109
114
|
/**
|
|
110
115
|
* 整目录参考文献列表。
|
package/lib/zotero/client.js
CHANGED
|
@@ -90,6 +90,88 @@ function toAttachment(raw) {
|
|
|
90
90
|
size: raw.links?.enclosure?.length ?? 0,
|
|
91
91
|
};
|
|
92
92
|
}
|
|
93
|
+
// ---- 笔记正文清洗 ------------------------------------------------------------
|
|
94
|
+
/**
|
|
95
|
+
* 笔记正文清洗。
|
|
96
|
+
*
|
|
97
|
+
* Zotero 的笔记 HTML 里塞了大量冗余标记,必须处理后再交给前端渲染:
|
|
98
|
+
* - `data-citation-items`:整份被引条目的 JSON(URL 编码),单条笔记能占几 KB;
|
|
99
|
+
* - `data-pid` / `data-first-child` 等 ProseMirror 内部标记;
|
|
100
|
+
* - `data-original-token` / `data-rawwidth` 等图片内部属性。
|
|
101
|
+
*
|
|
102
|
+
* 同时去掉脚本类标签与事件属性,避免正文里的原始 HTML 被直接注入 DOM。
|
|
103
|
+
* 图片的 `src` 保留(外链图),并去掉 `data-original-token` 等冗余属性。
|
|
104
|
+
*/
|
|
105
|
+
const NOTE_BLOCKED_TAGS = /<(script|style|noscript|iframe|object|embed)\b[\s\S]*?<\/\1\s*>/giu;
|
|
106
|
+
/** 无闭合标签的阻塞元素(base / link / meta 等)。 */
|
|
107
|
+
const NOTE_BLOCKED_VOID = /<\/?(?:base|link|meta)\b[^>]*>/giu;
|
|
108
|
+
const NOTE_EVENT_ATTR = /\s+on[a-z]+\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+)/giu;
|
|
109
|
+
const NOTE_DATA_ATTR = /\s+data-[a-z-]+\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+)/giu;
|
|
110
|
+
const NOTE_JS_URL = /\s+(?:href|src)\s*=\s*(?:"javascript:[^"]*"|'javascript:[^']*'|javascript:[^\s>]+)/giu;
|
|
111
|
+
/** 笔记正文最大字节数,超出截断。 */
|
|
112
|
+
const NOTE_MAX_BYTES = 200 * 1024;
|
|
113
|
+
/** HTML 实体解码表(用字符码拼装,避免源码里直接写实体被二次解码)。 */
|
|
114
|
+
const NAMED_ENTITIES = {
|
|
115
|
+
nbsp: ' ',
|
|
116
|
+
amp: String.fromCharCode(38),
|
|
117
|
+
lt: String.fromCharCode(60),
|
|
118
|
+
gt: String.fromCharCode(62),
|
|
119
|
+
quot: String.fromCharCode(34),
|
|
120
|
+
apos: String.fromCharCode(39),
|
|
121
|
+
};
|
|
122
|
+
/** 解码 HTML 实体(命名实体 + 数字实体)。 */
|
|
123
|
+
function decodeEntities(text) {
|
|
124
|
+
return text.replace(/&(#x[0-9a-f]+|#[0-9]+|[a-z]+);/giu, (match, body) => {
|
|
125
|
+
if (body.startsWith('#x') || body.startsWith('#X')) {
|
|
126
|
+
const code = Number.parseInt(body.slice(2), 16);
|
|
127
|
+
return Number.isFinite(code) ? String.fromCodePoint(code) : match;
|
|
128
|
+
}
|
|
129
|
+
if (body.startsWith('#')) {
|
|
130
|
+
const code = Number.parseInt(body.slice(1), 10);
|
|
131
|
+
return Number.isFinite(code) ? String.fromCodePoint(code) : match;
|
|
132
|
+
}
|
|
133
|
+
return NAMED_ENTITIES[body.toLowerCase()] ?? match;
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
/** 去标签后取纯文本(用于笔记标题摘要)。 */
|
|
137
|
+
function toPlainText(html) {
|
|
138
|
+
return decodeEntities(html
|
|
139
|
+
.replace(/<[^>]*>/gu, ' ')
|
|
140
|
+
.replace(/ /giu, ' '))
|
|
141
|
+
.replace(/\s+/gu, ' ')
|
|
142
|
+
.trim();
|
|
143
|
+
}
|
|
144
|
+
/** 清洗笔记正文 HTML。 */
|
|
145
|
+
export function sanitizeNoteHtml(html) {
|
|
146
|
+
return html
|
|
147
|
+
.replace(NOTE_BLOCKED_TAGS, '')
|
|
148
|
+
.replace(NOTE_BLOCKED_VOID, '')
|
|
149
|
+
.replace(NOTE_EVENT_ATTR, '')
|
|
150
|
+
.replace(NOTE_JS_URL, '')
|
|
151
|
+
.replace(NOTE_DATA_ATTR, '')
|
|
152
|
+
// 笔记里的图是外链图,限宽避免撑破右栏。
|
|
153
|
+
.replace(/<img\b([^>]*)>/giu, (match, attrs) => attrs.includes('style=') ? match : `<img${attrs} style="max-width:100%;height:auto">`)
|
|
154
|
+
.trim();
|
|
155
|
+
}
|
|
156
|
+
/** 笔记标题:正文纯文本的前 60 个字符(笔记条目本身没有 title 字段)。 */
|
|
157
|
+
function noteTitle(html) {
|
|
158
|
+
const text = toPlainText(html);
|
|
159
|
+
if (text === '')
|
|
160
|
+
return '(空笔记)';
|
|
161
|
+
return text.length > 60 ? `${text.slice(0, 60)}…` : text;
|
|
162
|
+
}
|
|
163
|
+
function toNote(raw) {
|
|
164
|
+
const html = sanitizeNoteHtml(raw.data?.note ?? '');
|
|
165
|
+
const maxBytes = NOTE_MAX_BYTES;
|
|
166
|
+
const truncated = html.length > maxBytes;
|
|
167
|
+
return {
|
|
168
|
+
key: raw.key,
|
|
169
|
+
title: noteTitle(html),
|
|
170
|
+
html: truncated ? html.slice(0, maxBytes) : html,
|
|
171
|
+
dateModified: raw.data?.dateModified ?? '',
|
|
172
|
+
truncated,
|
|
173
|
+
};
|
|
174
|
+
}
|
|
93
175
|
function toSummary(raw) {
|
|
94
176
|
const data = raw.data ?? {};
|
|
95
177
|
const itemType = data.itemType ?? '';
|
|
@@ -98,9 +180,14 @@ function toSummary(raw) {
|
|
|
98
180
|
: itemType === 'note'
|
|
99
181
|
? false
|
|
100
182
|
: (raw.meta?.numChildren ?? 0) > 0;
|
|
183
|
+
// 笔记没有 title 字段,用正文首段摘要当标题。
|
|
184
|
+
const title = data.title
|
|
185
|
+
|| data.filename
|
|
186
|
+
|| (itemType === 'note' ? noteTitle(data.note ?? '') : '')
|
|
187
|
+
|| '(无标题)';
|
|
101
188
|
return {
|
|
102
189
|
key: raw.key,
|
|
103
|
-
title
|
|
190
|
+
title,
|
|
104
191
|
creators: raw.meta?.creatorSummary ?? '',
|
|
105
192
|
year: yearOf(raw.meta, data),
|
|
106
193
|
itemType,
|
|
@@ -322,7 +409,7 @@ export async function getItemBib(key, style) {
|
|
|
322
409
|
return null;
|
|
323
410
|
}
|
|
324
411
|
}
|
|
325
|
-
/** 条目详情:元数据 + 附件 + 首个可读附件全文 + CSL。 */
|
|
412
|
+
/** 条目详情:元数据 + 附件 + 笔记 + 首个可读附件全文 + CSL。 */
|
|
326
413
|
export async function getItemDetail(key, style) {
|
|
327
414
|
const { body: raw } = await requestJson(`${libraryBase()}/items/${encode(key)}`);
|
|
328
415
|
const data = raw.data ?? {};
|
|
@@ -331,6 +418,9 @@ export async function getItemDetail(key, style) {
|
|
|
331
418
|
const children = itemType === 'attachment' ? [] : await getItemChildren(key);
|
|
332
419
|
const childAttachments = children.filter((c) => c.data?.itemType === 'attachment');
|
|
333
420
|
const attachments = itemType === 'attachment' ? [toAttachment(raw), ...childAttachments.map(toAttachment)] : childAttachments.map(toAttachment);
|
|
421
|
+
// 笔记是子条目(itemType=note);条目本身就是笔记时(独立笔记),正文即自身。
|
|
422
|
+
const childNotes = children.filter((c) => c.data?.itemType === 'note');
|
|
423
|
+
const notes = (itemType === 'note' ? [raw] : childNotes).map(toNote);
|
|
334
424
|
const readable = itemType === 'attachment'
|
|
335
425
|
? raw
|
|
336
426
|
: childAttachments.find((c) => c.data?.contentType === 'application/pdf') ?? childAttachments[0];
|
|
@@ -339,7 +429,7 @@ export async function getItemDetail(key, style) {
|
|
|
339
429
|
return {
|
|
340
430
|
key: raw.key,
|
|
341
431
|
itemType,
|
|
342
|
-
title: data.title || data.filename || '(无标题)',
|
|
432
|
+
title: data.title || data.filename || (itemType === 'note' ? notes[0]?.title ?? '(无标题)' : '(无标题)'),
|
|
343
433
|
creators: (data.creators ?? []).map(creatorName).filter((n) => n !== ''),
|
|
344
434
|
year: yearOf(raw.meta, data),
|
|
345
435
|
publicationTitle: data.publicationTitle ?? '',
|
|
@@ -349,6 +439,7 @@ export async function getItemDetail(key, style) {
|
|
|
349
439
|
tags: (data.tags ?? []).map((tag) => tag.tag ?? '').filter((tag) => tag !== ''),
|
|
350
440
|
collections: data.collections ?? [],
|
|
351
441
|
attachments,
|
|
442
|
+
notes,
|
|
352
443
|
fulltext,
|
|
353
444
|
bib,
|
|
354
445
|
};
|
package/lib/zotero/types.d.ts
CHANGED
|
@@ -39,6 +39,17 @@ export interface ZoteroAttachment {
|
|
|
39
39
|
contentType: string;
|
|
40
40
|
size: number;
|
|
41
41
|
}
|
|
42
|
+
/** 条目下的一条笔记(子条目 `itemType: "note"`)。 */
|
|
43
|
+
export interface ZoteroNote {
|
|
44
|
+
key: string;
|
|
45
|
+
/** 笔记标题:取正文首段纯文本摘要(笔记本身无标题字段)。 */
|
|
46
|
+
title: string;
|
|
47
|
+
/** 清洗后的正文 HTML(已剥离引用数据属性等,仅保留排版与图片)。 */
|
|
48
|
+
html: string;
|
|
49
|
+
dateModified: string;
|
|
50
|
+
/** 正文超长被截断时为 true。 */
|
|
51
|
+
truncated: boolean;
|
|
52
|
+
}
|
|
42
53
|
/** 详情页数据。 */
|
|
43
54
|
export interface ZoteroItemDetail {
|
|
44
55
|
key: string;
|
|
@@ -54,6 +65,8 @@ export interface ZoteroItemDetail {
|
|
|
54
65
|
/** 所属分类 key 列表。 */
|
|
55
66
|
collections: string[];
|
|
56
67
|
attachments: ZoteroAttachment[];
|
|
68
|
+
/** 该条目下的笔记(子条目 `itemType: "note"`)。 */
|
|
69
|
+
notes: ZoteroNote[];
|
|
57
70
|
fulltext: ZoteroFulltext | null;
|
|
58
71
|
bib: string | null;
|
|
59
72
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-plugin-zotero",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.1.4",
|
|
4
|
+
"description": "Connect the Zotero library on your computer to DSH: browse and search your own papers in the right sidebar, read metadata, notes and PDF full text, and bring a citation, an excerpt or a whole collection into the conversation with one click, so the model can answer from your own literature.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"dsh",
|
|
7
7
|
"deepseek",
|
|
@@ -33,17 +33,17 @@
|
|
|
33
33
|
"cordis.patch.yml"
|
|
34
34
|
],
|
|
35
35
|
"engines": {
|
|
36
|
-
"dsh": ">=0.2.
|
|
36
|
+
"dsh": ">=0.2.1-rc.3 <0.3.0-0"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
|
-
"@deepseek-ai/cordis": "^4.0.
|
|
40
|
-
"@deepseek-ai/schemastery": "^3.18.
|
|
39
|
+
"@deepseek-ai/cordis": "^4.0.5",
|
|
40
|
+
"@deepseek-ai/schemastery": "^3.18.5"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@deepseek-ai/cordis": "^4.0.
|
|
44
|
-
"@deepseek-ai/dsh": "0.2.
|
|
45
|
-
"@deepseek-ai/dsh-tools": "0.2.
|
|
46
|
-
"@deepseek-ai/schemastery": "3.18.
|
|
43
|
+
"@deepseek-ai/cordis": "^4.0.5",
|
|
44
|
+
"@deepseek-ai/dsh": "0.2.1-rc.3",
|
|
45
|
+
"@deepseek-ai/dsh-tools": "0.2.1-rc.3",
|
|
46
|
+
"@deepseek-ai/schemastery": "3.18.5",
|
|
47
47
|
"@types/node": "^24.19.2",
|
|
48
48
|
"@types/react": "~18.3.1",
|
|
49
49
|
"react": "^18.3.1",
|