dsh-plugin-zotero 0.9.1 → 0.9.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.
Files changed (2) hide show
  1. package/client/client.js +28 -6
  2. package/package.json +1 -1
package/client/client.js CHANGED
@@ -2240,6 +2240,15 @@ const KNOWN_SCOPES = [
2240
2240
  ];
2241
2241
  /** 文库根节点的 id(只存在于客户端,不对应任何 Zotero 分类)。 */
2242
2242
  const TREE_ROOT_ID = "__library__";
2243
+ /**
2244
+ * 是否选中「最近阅读」。
2245
+ *
2246
+ * 这份名单来自本插件的阅读记录,Host 端本来就按最后打开时间倒序拼好;
2247
+ * 标题排序对它没有意义,标签面板在这里也搜不到东西,所以两处都要按它关掉。
2248
+ */
2249
+ function isRecentSelection(collection) {
2250
+ return collection !== null && collection.scope === "recent";
2251
+ }
2243
2252
  function readSort() {
2244
2253
  try {
2245
2254
  const value = window.localStorage.getItem(SORT_KEY);
@@ -2583,14 +2592,15 @@ function reloadItems(options) {
2583
2592
  selectedItemKeys: /* @__PURE__ */ new Set()
2584
2593
  });
2585
2594
  patch({ itemsLoading: true });
2586
- const tags = [...state.selectedTags];
2595
+ const recent = isRecentSelection(state.selectedCollection);
2596
+ const tags = recent ? [] : [...state.selectedTags];
2587
2597
  fetchItems({
2588
2598
  ...selectionQuery(),
2589
2599
  q: state.query.trim(),
2590
2600
  tags: tags.length === 0 ? void 0 : tags,
2591
2601
  tagMode: tags.length === 0 ? void 0 : state.tagMode,
2592
- sort: state.sort === "none" ? void 0 : "title",
2593
- direction: state.sort === "none" ? void 0 : state.sort,
2602
+ sort: recent || state.sort === "none" ? void 0 : "title",
2603
+ direction: recent || state.sort === "none" ? void 0 : state.sort,
2594
2604
  limit: ITEMS_PAGE_SIZE,
2595
2605
  offset
2596
2606
  }, controller.signal).then((data) => {
@@ -2623,6 +2633,7 @@ function loadMoreItems() {
2623
2633
  * 状态写进 localStorage:所有会话共用同一块面板,重启后也保持上次的选择。
2624
2634
  */
2625
2635
  function cycleItemSort() {
2636
+ if (isRecentSelection(state.selectedCollection)) return;
2626
2637
  const next = state.sort === "none" ? "asc" : state.sort === "asc" ? "desc" : "none";
2627
2638
  patch({ sort: next });
2628
2639
  try {
@@ -40311,6 +40322,9 @@ function SearchField({ value, placeholder, clearLabel, onChange }) {
40311
40322
  * 多选,右上角「引用 N」把选中的每条各插一个胶囊。右键单行仍能直接插该条引用。
40312
40323
  * 列表分页(加载更多),筛选后为空与本来为空分开提示。
40313
40324
  *
40325
+ * 标题排序按钮只在真实分类 / 虚拟分类下出现:「最近阅读」恒按最后打开时间倒序,
40326
+ * 那一栏不给排序入口(见 {@link isRecentSelection})。
40327
+ *
40314
40328
  * 行内排版是两行:第一行只放标题,第二行小字灰色放「类型 + 年份 + 作者」,
40315
40329
  * 行与行之间用一条浅色细线分隔。
40316
40330
  */
@@ -40713,6 +40727,8 @@ function ItemList(props) {
40713
40727
  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;
40714
40728
  const name = selectionName(t, libraryName, selectedCollection);
40715
40729
  const isRealCollection = selectedCollection !== null && selectedCollection.key !== "__library__" && selectedCollection.scope === void 0;
40730
+ /** 「最近阅读」恒按最后打开时间倒序:不给标题排序入口,省得点了没反应。 */
40731
+ const recent = isRecentSelection(selectedCollection);
40716
40732
  const tags = [...selectedTags];
40717
40733
  const filtered = tags.length > 0 || query.trim() !== "";
40718
40734
  /** 按列表顺序取选中项,插进草稿的 chip 顺序才与眼前一致。 */
@@ -40758,7 +40774,7 @@ function ItemList(props) {
40758
40774
  onClick: () => onInsertCollection(selectedCollection),
40759
40775
  children: t("action.insertItemShort")
40760
40776
  }) : null,
40761
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button, {
40777
+ !recent && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button, {
40762
40778
  variant: "ghost",
40763
40779
  size: "sm",
40764
40780
  title: sortHint(t, sort),
@@ -41241,7 +41257,8 @@ const plainButtonStyle = {
41241
41257
  *
41242
41258
  * 与 Zotero 一致:左侧只有分类与标签,条目一律在右侧列表;列表行单击选中、
41243
41259
  * 双击才在本面板顶层开独立 tab(`onOpenItem`),详情不再占列表位置。
41244
- * 标签面板跟随当前目录:选中目录只列该目录自身的标签,切目录清空已选。
41260
+ * 标签面板跟随当前目录:选中目录只列该目录自身的标签,切目录清空已选;
41261
+ * 「最近阅读」下整块标签面板不渲染(只按最后打开时间列条目,不参与标签筛选)。
41245
41262
  *
41246
41263
  * 两栏之间是可拖动的分隔条(宽度存 localStorage,跨会话/重启都记住)。
41247
41264
  * 数据与选择状态都在 {@link paneStore} 的模块级单例里(跨会话共用同一块面板)。
@@ -41285,6 +41302,11 @@ function ZoteroPane({ t, inputActions, sessions, sessionId, onOpenItem }) {
41285
41302
  (0, react.useEffect)(() => {
41286
41303
  loadTree();
41287
41304
  }, []);
41305
+ /**
41306
+ * 「最近阅读」下不渲染标签面板:那份名单只来自本插件的阅读记录,
41307
+ * 标签过滤在里面筛不出东西,留着只会占掉分类树的高度。
41308
+ */
41309
+ const recent = isRecentSelection(selectedCollection);
41288
41310
  const insertion = useInsertion(t, sessions, sessionId, inputActions);
41289
41311
  const [treeWidth, setTreeWidth] = (0, react.useState)(readTreeWidth);
41290
41312
  const [splitHover, setSplitHover] = (0, react.useState)(false);
@@ -41410,7 +41432,7 @@ function ZoteroPane({ t, inputActions, sessions, sessionId, onOpenItem }) {
41410
41432
  onInsertCollection: insertion.insertCollection
41411
41433
  })
41412
41434
  }),
41413
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TagPanel, {
41435
+ !recent && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TagPanel, {
41414
41436
  t,
41415
41437
  tags,
41416
41438
  tagsLoading,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-plugin-zotero",
3
- "version": "0.9.1",
3
+ "version": "0.9.2",
4
4
  "description": "Map your Zotero library into DSH: let AI operate Zotero for you and help you read papers. Browse collections and tags in the sidebar, read PDFs with highlights in place, and cite excerpts, annotations, notes or whole items into the chat. The model works from the source text for reviews, comparisons and data extraction, and can also search and organize the library, import papers and attach translations back to items; first use needs the Zotero MCP plugin and the local API enabled.",
5
5
  "keywords": [
6
6
  "dsh",