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(sheets-ui): can't save first edit cell (#3781)

zhangwd29da2f2762c
diff --git a/packages/sheets-ui/src/services/editor-bridge.service.ts b/packages/sheets-ui/src/services/editor-bridge.service.ts
index 458297f02e..a1057b2efa 100644
--- a/packages/sheets-ui/src/services/editor-bridge.service.ts
+++ b/packages/sheets-ui/src/services/editor-bridge.service.ts
@@ -292,9 +292,19 @@ export class EditorBridgeService extends Disposable implements IEditorBridgeServ
}
const editCellState = this.getLatestEditCellState();
+ if (!editCellState) {
+ this._currentEditCellState = editCellState;
+ this._currentEditCellLayout = editCellState;
+ this._currentEditCellState$.next(editCellState);
+ this._currentEditCellLayout$.next(editCellState);
+ return;
+ }
- this._currentEditCellState = editCellState;
- this._currentEditCellState$.next(editCellState);
+ const { position, canvasOffset, scaleX, scaleY, ...rest } = editCellState;
+ this._currentEditCellState = rest;
+ this._currentEditCellLayout = { position, canvasOffset, scaleX, scaleY };
+ this._currentEditCellState$.next(this._currentEditCellState);
+ this._currentEditCellLayout$.next(this._currentEditCellLayout);
}
private _clearCurrentEditCellState() {