Skip to content

Build your own AI office with Univer Office SDK. Bring editing, calculation, collaboration, and file processing into your product for people and AI agents. Built on an extensible open-source core.

fix: issue 1155 (#1159)

Ran Luo44da1a0cd442
diff --git a/packages/sheets-ui/src/controllers/editor/end-edit.controller.ts b/packages/sheets-ui/src/controllers/editor/end-edit.controller.ts
index c58ff1fc81..3dac2bdaaa 100644
--- a/packages/sheets-ui/src/controllers/editor/end-edit.controller.ts
+++ b/packages/sheets-ui/src/controllers/editor/end-edit.controller.ts
@@ -61,7 +61,8 @@ function isRichText(body: IDocumentBody) {
return (
textRuns.some((textRun) => textRun.ts && !Tools.isEmptyObject(textRun.ts)) ||
- paragraphs.some((paragraph) => paragraph.bullet)
+ paragraphs.some((paragraph) => paragraph.bullet) ||
+ paragraphs.length >= 2
);
}
@@ -174,12 +175,12 @@ export class EndEditController extends Disposable {
const { unitId, sheetId, row, column, documentLayoutObject } = editCellState;
- this._moveCursor(keycode);
-
// If neither the formula bar editor nor the cell editor has been edited,
// it is considered that the content has not changed and returns directly.
const editorIsDirty = this._editorBridgeService.getEditorDirty();
if (editorIsDirty === false) {
+ this._moveCursor(keycode);
+
return;
}
@@ -197,7 +198,11 @@ export class EndEditController extends Disposable {
this._lexerTreeBuilder
);
- if (cellData == null) return;
+ if (cellData == null) {
+ this._moveCursor(keycode);
+
+ return;
+ }
const context = {
subUnitId: sheetId,
@@ -223,6 +228,9 @@ export class EndEditController extends Disposable {
value: cell,
});
+ // moveCursor need to put behind of SetRangeValuesCommand, fix https://github.com/dream-num/univer/issues/1155
+ this._moveCursor(keycode);
+
/**
* When closing the editor, switch to the current tab of the editor.
*/
diff --git a/packages/sheets-ui/src/controllers/editor/start-edit.controller.ts b/packages/sheets-ui/src/controllers/editor/start-edit.controller.ts
index f5224c18b0..fb028682c8 100644
--- a/packages/sheets-ui/src/controllers/editor/start-edit.controller.ts
+++ b/packages/sheets-ui/src/controllers/editor/start-edit.controller.ts
@@ -453,6 +453,7 @@ export class StartEditController extends Disposable {
}
}
+ // You can double-click on the cell or input content by keyboard to put the cell into the edit state.
private _initialStartEdit() {
this._onInputActivateSubscription = this._editorBridgeService.visible$.subscribe((param) => {
const { visible, eventType, keycode } = param;