Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

fix(desktop): 保留 CJK 列表空格

zhangyongjie56bc29c87c61
diff --git a/apps/desktop/src/renderer/__tests__/composerStructuredLists.test.ts b/apps/desktop/src/renderer/__tests__/composerStructuredLists.test.ts
index 275c484855..43825904a6 100644
--- a/apps/desktop/src/renderer/__tests__/composerStructuredLists.test.ts
+++ b/apps/desktop/src/renderer/__tests__/composerStructuredLists.test.ts
@@ -604,6 +604,22 @@ describe('composer live plain-list promotion', () => {
expect(editor.state.doc.lastChild?.type.name).toBe('paragraph');
});
+ it('keeps optional CJK spacing during live promotion', () => {
+ const editor = makeEditor({
+ type: 'doc',
+ content: [
+ {
+ type: 'paragraph',
+ content: [{ type: 'text', text: '3、 项目' }],
+ },
+ ],
+ });
+ selectDocumentEnd(editor);
+
+ expect(promoteTrailingPlainListParagraph(editor.view)).toBe(true);
+ expect(serializeEditorContent(editor).text).toBe('3、 项目');
+ });
+
it('promotes a trailing bullet-glyph row inserted outside input rules', () => {
const editor = makeEditor({
type: 'doc',
diff --git a/apps/desktop/src/renderer/components/new-chat/ComposerListNodes.ts b/apps/desktop/src/renderer/components/new-chat/ComposerListNodes.ts
index 53aa13df92..9811d356a0 100644
--- a/apps/desktop/src/renderer/components/new-chat/ComposerListNodes.ts
+++ b/apps/desktop/src/renderer/components/new-chat/ComposerListNodes.ts
@@ -60,7 +60,9 @@ function plainListParagraphMarker(text: string): PlainListParagraphMarker | null
if (cjkOrdered) {
return {
kind: 'ordered',
- prefixLength: cjkOrdered[0].length,
+ // Keep optional spacing in the item body so direct transactions and
+ // normalized documents serialize CJK markers identically.
+ prefixLength: cjkOrdered[1].length + cjkOrdered[2].length,
attrs: { start: Number(cjkOrdered[1]), marker: '、' },
};
}