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(sheet): formula input (#548)

Univer1c4092ce8b76
diff --git a/packages/sheets-plugin-formula-ui/src/controllers/prompt.controller.ts b/packages/sheets-plugin-formula-ui/src/controllers/prompt.controller.ts
index be75e2ae2a..04dfc5c097 100644
--- a/packages/sheets-plugin-formula-ui/src/controllers/prompt.controller.ts
+++ b/packages/sheets-plugin-formula-ui/src/controllers/prompt.controller.ts
@@ -996,6 +996,10 @@ export class PromptController extends Disposable {
const { collapsed, style } = activeRange;
+ this._currentInsertRefStringIndex = textSelectionOffset;
+
+ await this._fitEditorSize();
+
if (canUndo) {
this._commandService.executeCommand(ReplaceContentCommand.id, {
unitId: this._editorBridgeService.getCurrentEditorId(),
@@ -1024,10 +1028,6 @@ export class PromptController extends Disposable {
},
]);
}
-
- this._currentInsertRefStringIndex = textSelectionOffset;
-
- await this._fitEditorSize();
}
private async _fitEditorSize() {