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: fix collab editing would reset editor content

Wenzhao Hu3299e4e418b5
diff --git a/packages/sheets-ui/src/controllers/sheet-render.controller.ts b/packages/sheets-ui/src/controllers/sheet-render.controller.ts
index 41a28f92b5..888dd0a31c 100644
--- a/packages/sheets-ui/src/controllers/sheet-render.controller.ts
+++ b/packages/sheets-ui/src/controllers/sheet-render.controller.ts
@@ -116,7 +116,7 @@ export class SheetRenderController extends Disposable {
private _commandExecutedListener() {
this.disposeWithMe(
- this._commandService.onCommandExecuted((command: ICommandInfo) => {
+ this._commandService.onCommandExecuted((command: ICommandInfo, params) => {
const workbook = this._currentUniverService.getCurrentUniverSheetInstance();
const unitId = workbook.getUnitId();
diff --git a/packages/sheets/src/services/selection-manager.service.ts b/packages/sheets/src/services/selection-manager.service.ts
index 461a5fc184..06c74f99ac 100644
--- a/packages/sheets/src/services/selection-manager.service.ts
+++ b/packages/sheets/src/services/selection-manager.service.ts
@@ -164,8 +164,16 @@ export class SelectionManagerService implements IDisposable {
if (this._dirty === false) {
return;
}
- this._currentSelection = param;
+ if (
+ this._currentSelection?.unitId === param.unitId &&
+ this._currentSelection?.sheetId === param.sheetId &&
+ this._currentSelection.pluginName === param.pluginName
+ ) {
+ return;
+ }
+
+ this._currentSelection = param;
this._refresh(param);
}