From d5d0cc6671096efe4f0b093013300090de34593d Mon Sep 17 00:00:00 2001 From: xujing0521 <1332570609@qq.com> Date: Tue, 1 Dec 2026 16:08:14 +0800 Subject: [PATCH 1/2] feat: #WIK-18636 support shift+enter newline in single-text Align with Feishu multi-dimensional table: Shift+Enter inserts a line break while Enter confirms; focused cells keep newlines, collapsed cells show spaces. Co-authored-by: Cursor --- .../cell-editors/text/text-editor.component.ts | 13 ++++++++++++- .../components/cells/single-text.component.ts | 5 +++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/packages/grid/src/components/cell-editors/text/text-editor.component.ts b/packages/grid/src/components/cell-editors/text/text-editor.component.ts index 373b2f2b..923fbcc8 100644 --- a/packages/grid/src/components/cell-editors/text/text-editor.component.ts +++ b/packages/grid/src/components/cell-editors/text/text-editor.component.ts @@ -15,7 +15,7 @@ import { AbstractEditCellEditor } from '../abstract-cell-editor.component'; [thyAutofocus]="autoFocus()" [(ngModel)]="modelValue" (ngModelChange)="valueChange()" - (thyEnter)="updateValue()" + (thyEnter)="onEnter($event)" (blur)="updateValue()" thySize="lg" > @@ -61,6 +61,17 @@ export class TextCellEditorComponent extends AbstractEditCellEditor impl this.updateStyle(); } + /** + * Enter 确认并关闭;Shift+Enter 换行(与飞书多维表格一致) + */ + onEnter(event: KeyboardEvent) { + if (event.shiftKey) { + return; + } + event.preventDefault(); + this.updateValue(); + } + updateValue() { super.update(); this.closePopover(); diff --git a/packages/grid/src/renderer/components/cells/single-text.component.ts b/packages/grid/src/renderer/components/cells/single-text.component.ts index 605dae28..02e28332 100644 --- a/packages/grid/src/renderer/components/cells/single-text.component.ts +++ b/packages/grid/src/renderer/components/cells/single-text.component.ts @@ -151,7 +151,6 @@ export class AITableCellText extends CoverCellBase { ...text, height: text.height + AI_TABLE_CELL_PADDING + AI_TABLE_CELL_LINE_BORDER }; - }); textMaxWidth = computed(() => { @@ -165,6 +164,9 @@ export class AITableCellText extends CoverCellBase { if (isUndefinedOrNull(textRender)) { return; } + if (this.isExpand()) { + return textRender.replace(/\r\n|\r/g, '\n'); + } return textRender.replace(/\r|\n/g, ' '); }); @@ -217,7 +219,6 @@ export class AITableCellText extends CoverCellBase { ellipsis: false, zIndex }; - } return; }); From af4e8f495f05d77dcca6e2d2d3c48bbc8b23c508 Mon Sep 17 00:00:00 2001 From: xujing0521 <1332570609@qq.com> Date: Tue, 1 Dec 2026 16:09:24 +0800 Subject: [PATCH 2/2] fix: fix test --- .../src/components/cell-editors/text/text-editor.component.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/packages/grid/src/components/cell-editors/text/text-editor.component.ts b/packages/grid/src/components/cell-editors/text/text-editor.component.ts index 923fbcc8..84034f9e 100644 --- a/packages/grid/src/components/cell-editors/text/text-editor.component.ts +++ b/packages/grid/src/components/cell-editors/text/text-editor.component.ts @@ -61,9 +61,6 @@ export class TextCellEditorComponent extends AbstractEditCellEditor impl this.updateStyle(); } - /** - * Enter 确认并关闭;Shift+Enter 换行(与飞书多维表格一致) - */ onEnter(event: KeyboardEvent) { if (event.shiftKey) { return;