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): 补齐长序号列表排版

zhangyongjief6c2358328bb
diff --git a/apps/desktop/src/renderer/__tests__/composerStructuredLists.test.ts b/apps/desktop/src/renderer/__tests__/composerStructuredLists.test.ts
index dca870c106..94d6d42f86 100644
--- a/apps/desktop/src/renderer/__tests__/composerStructuredLists.test.ts
+++ b/apps/desktop/src/renderer/__tests__/composerStructuredLists.test.ts
@@ -1393,6 +1393,21 @@ describe('composer structured list serialization', () => {
expect(serializeEditorContent(editor).text).toBe('2. ');
});
+ it('preserves the trailing separator for a generated nine-digit marker', () => {
+ const editor = makeEditor({
+ type: 'doc',
+ content: [
+ {
+ type: 'orderedList',
+ attrs: { start: 99999999, marker: '.' },
+ content: [{ type: 'listItem', content: [{ type: 'paragraph' }] }],
+ },
+ ],
+ });
+
+ expect(serializeEditorContent(editor).text).toBe('99999999. ');
+ });
+
it('keeps partial inline boundaries when copying one ordered-list item', () => {
const editor = makeEditor({
type: 'doc',
diff --git a/apps/desktop/src/renderer/components/new-chat/composerContentSerialization.ts b/apps/desktop/src/renderer/components/new-chat/composerContentSerialization.ts
index e65bcf0d5b..96508d0ffd 100644
--- a/apps/desktop/src/renderer/components/new-chat/composerContentSerialization.ts
+++ b/apps/desktop/src/renderer/components/new-chat/composerContentSerialization.ts
@@ -38,7 +38,7 @@ export interface SerializedComposerContent {
type OrderedMarker = '.' | ')' | '、';
const EMPTY_LIST_ITEM_MARKER_RE =
- /(?:^|\n)[ \t]*(?:[1-9]\d{0,7}[.)][ \t]+|[1-9]\d{0,7}、[ \t]*|[-+*•][ \t]+)$/;
+ /(?:^|\n)[ \t]*(?:[1-9]\d{0,8}[.)][ \t]+|[1-9]\d{0,8}、[ \t]*|[-+*•][ \t]+)$/;
const TAB_SIZE = 4;
@@ -56,8 +56,8 @@ function expandedIndentWidth(text: string): number {
function literalListContinuationPrefix(text: string): string | null {
const match =
- text.match(/^([ \t]+)(?:[-+*•]|[1-9]\d{0,7}[.)])([ \t]+)/) ??
- text.match(/^([ \t]+)[1-9]\d{0,7}、[ \t]*/);
+ text.match(/^([ \t]+)(?:[-+*•]|[1-9]\d{0,8}[.)])([ \t]+)/) ??
+ text.match(/^([ \t]+)[1-9]\d{0,8}、[ \t]*/);
if (!match) return null;
return ' '.repeat(expandedIndentWidth(match[0]));
}
diff --git a/apps/desktop/src/renderer/styles/globals.css b/apps/desktop/src/renderer/styles/globals.css
index 73f90496ac..938c05d42e 100644
--- a/apps/desktop/src/renderer/styles/globals.css
+++ b/apps/desktop/src/renderer/styles/globals.css
@@ -375,6 +375,9 @@ html:lang(ko) {
[data-chat-input-root] .ProseMirror ol[data-marker-digits='8'] {
--composer-list-padding: 5.8em;
}
+[data-chat-input-root] .ProseMirror ol[data-marker-digits='9'] {
+ --composer-list-padding: 6.4em;
+}
[data-chat-input-root] .ProseMirror ul {
list-style-type: disc;
}