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(api): fix setTabColor API was not working when setting inactive worksheets (#6395)

wpxp12345657c51eea5873
diff --git a/packages/sheets/src/commands/commands/set-tab-color.command.ts b/packages/sheets/src/commands/commands/set-tab-color.command.ts
index 26d5c9f8fb..a99112b893 100644
--- a/packages/sheets/src/commands/commands/set-tab-color.command.ts
+++ b/packages/sheets/src/commands/commands/set-tab-color.command.ts
@@ -16,12 +16,12 @@
import type { IAccessor, ICommand } from '@univerjs/core';
import type { ISetTabColorMutationParams } from '../mutations/set-tab-color.mutation';
-
+import type { ISheetCommandSharedParams } from '../utils/interface';
import { CommandType, ICommandService, IUndoRedoService, IUniverInstanceService } from '@univerjs/core';
import { SetTabColorMutation, SetTabColorUndoMutationFactory } from '../mutations/set-tab-color.mutation';
import { getSheetCommandTarget } from './utils/target-util';
-export interface ISetTabColorCommandParams {
+export interface ISetTabColorCommandParams extends Partial<ISheetCommandSharedParams> {
value: string;
}
@@ -33,7 +33,7 @@ export const SetTabColorCommand: ICommand = {
const commandService = accessor.get(ICommandService);
const undoRedoService = accessor.get(IUndoRedoService);
- const target = getSheetCommandTarget(accessor.get(IUniverInstanceService));
+ const target = getSheetCommandTarget(accessor.get(IUniverInstanceService), params);
if (!target) return false;
const { unitId, subUnitId } = target;