Преглед изворни кода

🐛 (dashboard-v6): 段落菜单「添加到手推车」「复制句子模板」点了没反应

paragraph-content 返回的是 sentences([book, para, start, end] 坐标数组),
前端类型却写成从未返回的 sentenceIds,ParaHandle 里 sentences.map 对
undefined 抛错。类型改成 sentences,在 Paragraph 里拼成 b-p-s-e 句子编号。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
visuddhinanda пре 6 часа
родитељ
комит
bbfd564561

+ 2 - 1
dashboard-v6/src/api/pali-text.ts

@@ -172,7 +172,8 @@ export interface IParagraphNode {
   para: number;
   mode?: ArticleMode;
   channels?: string[];
-  sentenceIds: string[];
+  /** 段落内的句子坐标 [book, para, wordStart, wordEnd] */
+  sentences: [number, number, number, number][];
   children?: IWidgetSentEditInner[];
 }
 

+ 6 - 1
dashboard-v6/src/components/tipitaka/components/Paragraph.tsx

@@ -22,7 +22,7 @@ const Paragraph = ({
   para,
   mode,
   channels,
-  sentenceIds,
+  sentences,
   children,
   loading,
   onModeChange,
@@ -53,6 +53,11 @@ const Paragraph = ({
     }
   }, [book, focus, para]);
 
+  const sentenceIds = useMemo(
+    () => (sentences ?? []).map((item) => item.join("-")),
+    [sentences]
+  );
+
   const borderColor = isFocus ? "#e35f00bd " : "rgba(128, 128, 128, 0.3)";
 
   const border = mode === "read" ? "" : "2px solid " + borderColor;