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.
TypeScript boardcollaborationdocdocxexceloffce365officepdfpptpptxpresentationsdksheetslidesspreadsheetuniverwordwordprocessorworkspacexlsx
fix: fix set active worksheet (#808)
Wenzhao Huf5968ccd6454
diff --git a/packages/core/src/services/command/command.service.ts b/packages/core/src/services/command/command.service.tsindex b82d113b05..051cb8251b 100644--- a/packages/core/src/services/command/command.service.ts+++ b/packages/core/src/services/command/command.service.ts@@ -299,11 +299,12 @@ export class CommandService implements ICommandService {const stackItemDisposable = this._pushCommandExecutionStack(commandInfo);+ this._beforeCommandExecutionListeners.forEach((listener) => listener(commandInfo, options));const result = this._syncExecute<P, R>(command as ICommand<P, R>, params);- stackItemDisposable.dispose();-this._commandExecutedListeners.forEach((listener) => listener(commandInfo, options));+ stackItemDisposable.dispose();+return result;}diff --git a/packages/sheets-ui/src/controllers/active-worksheet/active-worksheet.controller.ts b/packages/sheets-ui/src/controllers/active-worksheet/active-worksheet.controller.tsindex 69b2116e9b..aaaaf5b685 100644--- a/packages/sheets-ui/src/controllers/active-worksheet/active-worksheet.controller.ts+++ b/packages/sheets-ui/src/controllers/active-worksheet/active-worksheet.controller.ts@@ -45,7 +45,7 @@ export class ActiveWorksheetController extends Disposable {super();this.disposeWithMe(- this._commandService.onCommandExecuted((command, options) => {+ this._commandService.beforeCommandExecuted((command, options) => {if (command.id === RemoveSheetMutation.id) {return this._beforeAdjustActiveSheetOnRemoveSheet(command as IMutationInfo<IRemoveSheetMutationParams>