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): fix some bugs about scroll & format-painter (#322)

YuHongac40d2537e5b
diff --git a/packages/base-sheets/src/Controller/Selection.controller.ts b/packages/base-sheets/src/Controller/Selection.controller.ts
index 8c4d3e4ba9..69a8d18e87 100644
--- a/packages/base-sheets/src/Controller/Selection.controller.ts
+++ b/packages/base-sheets/src/Controller/Selection.controller.ts
@@ -161,11 +161,12 @@ export class SelectionController extends Disposable {
const workbook = this._currentUniverService.getCurrentUniverSheetInstance();
const unitId = workbook.getUnitId();
const sheetId = workbook.getActiveSheet().getSheetId();
+ const current = this._selectionManagerService.getCurrent();
this._commandService.executeCommand(SetSelectionsOperation.id, {
unitId,
sheetId,
- pluginName: NORMAL_SELECTION_PLUGIN_NAME,
+ pluginName: current?.pluginName || NORMAL_SELECTION_PLUGIN_NAME,
selections: selectionDataWithStyleList.map((selectionDataWithStyle) =>
convertSelectionDataToRange(selectionDataWithStyle)
),
diff --git a/packages/base-sheets/src/Controller/freeze.controller.ts b/packages/base-sheets/src/Controller/freeze.controller.ts
index c5c2e35e53..e5e3c7d3a7 100644
--- a/packages/base-sheets/src/Controller/freeze.controller.ts
+++ b/packages/base-sheets/src/Controller/freeze.controller.ts
@@ -24,6 +24,7 @@ import { Inject } from '@wendellhu/redi';
import { getCoordByOffset, getSheetObject } from '../Basics/component-tools';
import { SHEET_COMPONENT_HEADER_LAYER_INDEX, VIEWPORT_KEY } from '../Basics/Const/DEFAULT_SPREADSHEET_VIEW';
import { SetFrozenCommand } from '../commands/commands/set-frozen.command';
+import { ScrollCommand } from '../commands/commands/set-scroll.command';
import { ISetFrozenMutationParams, SetFrozenMutation } from '../commands/mutations/set-frozen.mutation';
import { SetZoomRatioOperation } from '../commands/operations/set-zoom-ratio.operation';
import { ScrollManagerService } from '../services/scroll-manager.service';
@@ -608,13 +609,12 @@ export class FreezeController extends Disposable {
right: 0,
});
viewMain.resetPadding();
- viewMain.scrollTo(
- {
- x: 0,
- y: 0,
- },
- false
- );
+ this._commandService.executeCommand(ScrollCommand.id, {
+ sheetViewStartRow: 0,
+ sheetViewStartColumn: 0,
+ offsetX: 0,
+ offsetY: 0,
+ });
} else if (isTopView === true && isLeftView === false) {
const topGap = endSheetView.startY - startSheetView.startY;
viewMain.resize({
@@ -629,12 +629,10 @@ export class FreezeController extends Disposable {
startX: 0,
endX: 0,
});
- viewMain.scrollTo(
- {
- y: 0,
- },
- false
- );
+ this._commandService.executeCommand(ScrollCommand.id, {
+ sheetViewStartRow: 0,
+ offsetY: 0,
+ });
viewMainTop.resize({
left: rowHeaderWidthAndMarginLeft,
top: columnHeaderHeightAndMarginTop,
@@ -695,12 +693,10 @@ export class FreezeController extends Disposable {
startY: 0,
endY: 0,
});
- viewMain.scrollTo(
- {
- x: 0,
- },
- false
- );
+ this._commandService.executeCommand(ScrollCommand.id, {
+ sheetViewStartColumn: 0,
+ offsetX: 0,
+ });
viewMainLeft.resize({
left: rowHeaderWidthAndMarginLeft,
top: columnHeaderHeightAndMarginTop,
@@ -763,13 +759,12 @@ export class FreezeController extends Disposable {
startX: startSheetView.startX,
endX: endSheetView.startX,
});
- viewMain.scrollTo(
- {
- x: 0,
- y: 0,
- },
- false
- );
+ this._commandService.executeCommand(ScrollCommand.id, {
+ sheetViewStartRow: 0,
+ sheetViewStartColumn: 0,
+ offsetX: 0,
+ offsetY: 0,
+ });
viewMainLeft.resize({
left: rowHeaderWidthAndMarginLeft,
top: columnHeaderHeightAndMarginTop + topGap,
diff --git a/packages/base-sheets/src/Controller/header-menu.controller.ts b/packages/base-sheets/src/Controller/header-menu.controller.ts
index 627b768366..3eed946de5 100644
--- a/packages/base-sheets/src/Controller/header-menu.controller.ts
+++ b/packages/base-sheets/src/Controller/header-menu.controller.ts
@@ -5,7 +5,6 @@ import { Inject } from '@wendellhu/redi';
import { getCoordByOffset, getSheetObject } from '../Basics/component-tools';
import { SHEET_COMPONENT_HEADER_LAYER_INDEX } from '../Basics/Const/DEFAULT_SPREADSHEET_VIEW';
import { SelectionManagerService } from '../services/selection/selection-manager.service';
-import { ISelectionRenderService } from '../services/selection/selection-render.service';
import { SheetSkeletonManagerService } from '../services/sheet-skeleton-manager.service';
import { HEADER_MENU_SHAPE_TYPE, HeaderMenuShape } from '../View/header-menu-shape';
@@ -38,7 +37,6 @@ export class HeaderMenuController extends Disposable {
@Inject(SheetSkeletonManagerService) private readonly _sheetSkeletonManagerService: SheetSkeletonManagerService,
@IUniverInstanceService private readonly _currentUniverService: IUniverInstanceService,
@IRenderManagerService private readonly _renderManagerService: IRenderManagerService,
- @ISelectionRenderService
@Inject(SelectionManagerService)
private readonly _selectionManagerService: SelectionManagerService
) {
diff --git a/packages/base-sheets/src/Controller/scroll.controller.ts b/packages/base-sheets/src/Controller/scroll.controller.ts
index 7c9015f71f..dfd4044983 100644
--- a/packages/base-sheets/src/Controller/scroll.controller.ts
+++ b/packages/base-sheets/src/Controller/scroll.controller.ts
@@ -198,6 +198,7 @@ export class ScrollController extends Disposable {
});
}
+ // scroll command -> scroll manager service -> scrollInfo$ -> viewport scroll API
private _scrollSubscribeBinding() {
this._scrollManagerService.scrollInfo$.subscribe((param) => {
const skeleton = this._sheetSkeletonManagerService.getCurrent()?.skeleton;
diff --git a/packages/base-sheets/src/SheetPlugin.ts b/packages/base-sheets/src/SheetPlugin.ts
index d3a2f75d9f..51c6bad048 100644
--- a/packages/base-sheets/src/SheetPlugin.ts
+++ b/packages/base-sheets/src/SheetPlugin.ts
@@ -56,7 +56,6 @@ export class SheetPlugin extends Plugin {
// services
[BorderStyleManagerService],
[SheetSkeletonManagerService],
- [SelectionRenderService],
[
ISelectionRenderService,
{
diff --git a/packages/base-sheets/src/commands/commands/set-scroll.command.ts b/packages/base-sheets/src/commands/commands/set-scroll.command.ts
index 8bbecfefc8..367021c6d2 100644
--- a/packages/base-sheets/src/commands/commands/set-scroll.command.ts
+++ b/packages/base-sheets/src/commands/commands/set-scroll.command.ts
@@ -4,10 +4,10 @@ import { ScrollManagerService } from '../../services/scroll-manager.service';
import { SetScrollOperation } from '../operations/scroll.operation';
export interface IScrollCommandParams {
- offsetX: number;
- offsetY: number;
- sheetViewStartRow: number;
- sheetViewStartColumn: number;
+ offsetX?: number;
+ offsetY?: number;
+ sheetViewStartRow?: number;
+ sheetViewStartColumn?: number;
}
export interface ISetScrollRelativeCommandParams {
@@ -53,11 +53,16 @@ export const SetScrollRelativeCommand: ICommand<ISetScrollRelativeCommandParams>
export const ScrollCommand: ICommand<IScrollCommandParams> = {
id: 'sheet.command.scroll-view',
type: CommandType.COMMAND,
- handler: async (accessor, params = { sheetViewStartRow: 0, sheetViewStartColumn: 0, offsetX: 0, offsetY: 0 }) => {
+ handler: async (accessor, params) => {
+ if (!params) {
+ return false;
+ }
const univerInstanceService = accessor.get(IUniverInstanceService);
const currentWorkbook = univerInstanceService.getCurrentUniverSheetInstance();
const currentWorksheet = currentWorkbook.getActiveSheet();
+ const scrollManagerService = accessor.get(ScrollManagerService);
+ const currentScroll = scrollManagerService.getCurrentScroll();
if (!currentWorksheet) {
return false;
@@ -66,14 +71,20 @@ export const ScrollCommand: ICommand<IScrollCommandParams> = {
const commandService = accessor.get(ICommandService);
const { sheetViewStartRow, sheetViewStartColumn, offsetX, offsetY } = params;
+ const {
+ sheetViewStartColumn: currentColumn,
+ sheetViewStartRow: currentRow,
+ offsetX: currentOffsetX,
+ offsetY: currentOffsetY,
+ } = currentScroll || {};
return commandService.executeCommand(SetScrollOperation.id, {
unitId: currentWorkbook.getUnitId(),
sheetId: currentWorksheet.getSheetId(),
- sheetViewStartRow,
- sheetViewStartColumn,
- offsetX,
- offsetY,
+ sheetViewStartRow: sheetViewStartRow ?? currentColumn,
+ sheetViewStartColumn: sheetViewStartColumn ?? currentRow,
+ offsetX: offsetX ?? currentOffsetX,
+ offsetY: offsetY ?? currentOffsetY,
});
},
};
diff --git a/packages/base-sheets/src/commands/operations/selection.operation.ts b/packages/base-sheets/src/commands/operations/selection.operation.ts
index aa264cf2eb..77411f7742 100644
--- a/packages/base-sheets/src/commands/operations/selection.operation.ts
+++ b/packages/base-sheets/src/commands/operations/selection.operation.ts
@@ -4,6 +4,7 @@ import { CommandType, IOperation } from '@univerjs/core';
import { ISelectionWithStyle } from '../../Basics/selection';
import { SelectionManagerService } from '../../services/selection/selection-manager.service';
+import { ISelectionRenderService } from '../../services/selection/selection-render.service';
export interface ISetSelectionsOperationParams {
workbookId: string;
@@ -12,25 +13,65 @@ export interface ISetSelectionsOperationParams {
selections: ISelectionWithStyle[];
}
+export interface ISetCopySelectionsOperationParams {
+ workbookId: string;
+ worksheetId: string;
+ pluginName: string;
+ selections: ISelectionWithStyle[];
+ show: boolean;
+}
+
+export const FORMAT_PAINTER_SELECTION_PLUGIN_NAME = 'formatPainterSelectionPluginName';
+
export const SetSelectionsOperation: IOperation<ISetSelectionsOperationParams> = {
id: 'sheet.operation.set-selections',
type: CommandType.OPERATION,
handler: async (accessor, params) => {
const selectionManagerService = accessor.get(SelectionManagerService);
- selectionManagerService.replace(params!.selections);
+ const selections = params?.selections;
+ if (!selections) {
+ return false;
+ }
+ if (params.pluginName === FORMAT_PAINTER_SELECTION_PLUGIN_NAME) {
+ selections.length > 1 && selections.splice(1, selections.length - 2);
+ }
+
+ selectionManagerService.replace(selections);
return true;
},
};
-export const SetCopySelectionsOperation: IOperation<ISetSelectionsOperationParams> = {
+export const SetCopySelectionsOperation: IOperation<ISetCopySelectionsOperationParams> = {
id: 'sheet.operation.set-copy-selection',
type: CommandType.OPERATION,
handler: async (accessor, params) => {
const selectionManagerService = accessor.get(SelectionManagerService);
+ const selectionRenderService = accessor.get(ISelectionRenderService);
if (!params) {
return false;
}
- selectionManagerService.replaceCopySelection(params!);
+ if (!params.show) {
+ selectionRenderService.disableShowPrevious();
+ selectionManagerService.makeDirty(true);
+ selectionManagerService.reset();
+ selectionManagerService.add(params.selections);
+ return true;
+ }
+ selectionRenderService.enableShowPrevious();
+ selectionManagerService.makeDirty(false);
+ selectionManagerService.setCurrentSelectionNotRefresh({
+ pluginName: params.pluginName,
+ unitId: params.workbookId,
+ sheetId: params.worksheetId,
+ });
+ const selection = params.selections[0];
+ const { range, primary } = selection;
+ const newSelection = {
+ range,
+ primary,
+ style: selectionManagerService.createCopyPasteSelection(),
+ };
+ selectionManagerService.add([newSelection]);
return true;
},
};
diff --git a/packages/base-sheets/src/index.ts b/packages/base-sheets/src/index.ts
index de4ada1cde..631a75a8c5 100644
--- a/packages/base-sheets/src/index.ts
+++ b/packages/base-sheets/src/index.ts
@@ -5,11 +5,7 @@ export * from './SheetPlugin';
// #region services
export { BorderStyleManagerService } from './services/border-style-manager.service';
-export {
- COPY_SELECTION_PLUGIN_NAME,
- NORMAL_SELECTION_PLUGIN_NAME,
- SelectionManagerService,
-} from './services/selection/selection-manager.service';
+export { NORMAL_SELECTION_PLUGIN_NAME, SelectionManagerService } from './services/selection/selection-manager.service';
// #endregion
@@ -157,7 +153,11 @@ export {
} from './commands/mutations/set-worksheet-row-height.mutation';
export { SetScrollOperation } from './commands/operations/scroll.operation';
export { type ISetSelectionsOperationParams } from './commands/operations/selection.operation';
-export { SetCopySelectionsOperation, SetSelectionsOperation } from './commands/operations/selection.operation';
+export {
+ FORMAT_PAINTER_SELECTION_PLUGIN_NAME,
+ SetCopySelectionsOperation,
+ SetSelectionsOperation,
+} from './commands/operations/selection.operation';
export { SetZoomRatioOperation } from './commands/operations/set-zoom-ratio.operation';
export * from './Locale';
export { ISelectionRenderService, SelectionRenderService } from './services/selection/selection-render.service';
diff --git a/packages/base-sheets/src/services/selection/selection-manager.service.ts b/packages/base-sheets/src/services/selection/selection-manager.service.ts
index b29acfbf95..6f5113a3a8 100644
--- a/packages/base-sheets/src/services/selection/selection-manager.service.ts
+++ b/packages/base-sheets/src/services/selection/selection-manager.service.ts
@@ -4,10 +4,8 @@ import { IDisposable, Inject } from '@wendellhu/redi';
import { BehaviorSubject } from 'rxjs';
import { getNormalSelectionStyle, ISelectionStyle, ISelectionWithStyle } from '../../Basics/selection';
-import { ISetSelectionsOperationParams } from '../../commands/operations/selection.operation';
export const NORMAL_SELECTION_PLUGIN_NAME = 'normalSelectionPluginName';
-export const COPY_SELECTION_PLUGIN_NAME = 'copySelectionPluginName';
export interface ISelectionManagerSearchParam {
pluginName: string;
@@ -29,7 +27,6 @@ export class SelectionManagerService implements IDisposable {
private readonly _selectionInfo: ISelectionInfo = new Map();
private _currentSelection: Nullable<ISelectionManagerSearchParam> = null;
- private _currentCopySelection: Nullable<ISelectionManagerSearchParam> = null;
// private _isSelectionEnabled: boolean = true;
@@ -99,7 +96,6 @@ export class SelectionManagerService implements IDisposable {
if (this._dirty === false) {
return;
}
-
this._currentSelection = param;
this.refresh(param);
@@ -162,32 +158,6 @@ export class SelectionManagerService implements IDisposable {
this.refresh(this._currentSelection);
}
- replaceCopySelection(insertParam: ISetSelectionsOperationParams) {
- let selectionDatas: ISelectionWithStyle[];
- if (insertParam.selections.length === 0) {
- selectionDatas = [];
- } else {
- selectionDatas = [
- {
- ...insertParam.selections[0],
- style: this.createCopyPasteSelection(),
- },
- ];
- }
- this._replaceByParam({
- selectionDatas,
- pluginName: insertParam.pluginName,
- unitId: insertParam.workbookId,
- sheetId: insertParam.worksheetId,
- });
- this._currentCopySelection = {
- pluginName: COPY_SELECTION_PLUGIN_NAME,
- unitId: insertParam.workbookId,
- sheetId: insertParam.worksheetId,
- };
- this.refresh();
- }
-
replaceWithNoRefresh(selectionDatas: ISelectionWithStyle[]) {
if (this._currentSelection == null) {
return;
@@ -292,11 +262,7 @@ export class SelectionManagerService implements IDisposable {
}
private refresh(param?: ISelectionManagerSearchParam): void {
- const res = [
- ...(this._getSelectionDatas(param) || this._getSelectionDatas(this._currentSelection) || []),
- ...(this._getSelectionDatas(this._currentCopySelection) || []),
- ];
- this._selectionInfo$.next(res);
+ this._selectionInfo$.next(this._getSelectionDatas(param));
}
private _getFirstByParam(param: Nullable<ISelectionManagerSearchParam>): Readonly<Nullable<ISelectionWithStyle>> {
diff --git a/packages/base-sheets/src/services/selection/selection-render.service.ts b/packages/base-sheets/src/services/selection/selection-render.service.ts
index 7833b5ff69..f1ab564d0d 100644
--- a/packages/base-sheets/src/services/selection/selection-render.service.ts
+++ b/packages/base-sheets/src/services/selection/selection-render.service.ts
@@ -121,6 +121,8 @@ export class SelectionRenderService implements ISelectionRenderService {
private _isSelectionEnabled: boolean = true;
+ private _isShowPreviousEnable: boolean | number = 0;
+
private readonly _selectionRangeWithStyle$ = new BehaviorSubject<ISelectionWithCoordAndStyle[]>([]);
readonly selectionRangeWithStyle$ = this._selectionRangeWithStyle$.asObservable();
@@ -163,6 +165,14 @@ export class SelectionRenderService implements ISelectionRenderService {
this._isSelectionEnabled = false;
}
+ enableShowPrevious() {
+ this._isShowPreviousEnable = true;
+ }
+
+ disableShowPrevious() {
+ this._isShowPreviousEnable = false;
+ }
+
getViewPort() {
return this._activeViewport;
}
@@ -442,7 +452,7 @@ export class SelectionRenderService implements ISelectionRenderService {
}
// In addition to pressing the ctrl or shift key, we must clear the previous selection
- if (curControls.length > 0 && !evt.ctrlKey && !evt.shiftKey) {
+ if (curControls.length > 0 && !evt.ctrlKey && !evt.shiftKey && !this._isShowPreviousEnable) {
for (const control of curControls) {
control.dispose();
}
diff --git a/packages/ui-plugin-sheets/src/commands/commands/rename.command.ts b/packages/ui-plugin-sheets/src/commands/commands/rename.command.ts
index 3f2bca49b4..1395d200ba 100644
--- a/packages/ui-plugin-sheets/src/commands/commands/rename.command.ts
+++ b/packages/ui-plugin-sheets/src/commands/commands/rename.command.ts
@@ -7,8 +7,8 @@ interface IRenameCommandParams {
worksheetId: string;
}
-export const RenameSheetCommand: ICommand = {
- id: 'ui-sheet.command.rename-sheet',
+export const RenameSheetOperation: ICommand = {
+ id: 'sheet.command.rename-sheet',
type: CommandType.OPERATION,
handler: async (accessor: IAccessor, params?: IRenameCommandParams) => {
const sheetBarService = accessor.get(ISheetBarService);
diff --git a/packages/ui-plugin-sheets/src/commands/commands/set-format-painter.command.ts b/packages/ui-plugin-sheets/src/commands/commands/set-format-painter.command.ts
index 2f5fc8d4f2..1774ae971b 100644
--- a/packages/ui-plugin-sheets/src/commands/commands/set-format-painter.command.ts
+++ b/packages/ui-plugin-sheets/src/commands/commands/set-format-painter.command.ts
@@ -1,4 +1,9 @@
-import { COPY_SELECTION_PLUGIN_NAME, SelectionManagerService, SetCopySelectionsOperation } from '@univerjs/base-sheets';
+import {
+ FORMAT_PAINTER_SELECTION_PLUGIN_NAME,
+ NORMAL_SELECTION_PLUGIN_NAME,
+ SelectionManagerService,
+ SetCopySelectionsOperation,
+} from '@univerjs/base-sheets';
import { CommandType, ICommand, ICommandService, IUniverInstanceService } from '@univerjs/core';
import { IAccessor } from '@wendellhu/redi';
@@ -63,25 +68,29 @@ export const SetCopySelectionCommand: ICommand = {
const workbookId = currentService.getCurrentUniverSheetInstance().getUnitId();
const worksheetId = currentService.getCurrentUniverSheetInstance().getActiveSheet().getSheetId();
let setSelectionsParam;
+ const selectionManagerService = accessor.get(SelectionManagerService);
+ const selections = selectionManagerService.getSelections();
+ if (!selections || selections.length === 0) {
+ return false;
+ }
+
if (params.show) {
- const selectionManagerService = accessor.get(SelectionManagerService);
- const selections = selectionManagerService.getSelections();
- if (!selections || selections.length === 0) {
- return false;
- }
const { range, primary, style } = selections[0];
setSelectionsParam = {
workbookId,
worksheetId,
- pluginName: COPY_SELECTION_PLUGIN_NAME,
+ pluginName: FORMAT_PAINTER_SELECTION_PLUGIN_NAME,
selections: [{ range, primary, style: null }],
+ show: true,
};
} else {
+ const { range, primary, style } = selections[selections.length - 1];
setSelectionsParam = {
workbookId,
worksheetId,
- pluginName: COPY_SELECTION_PLUGIN_NAME,
- selections: [],
+ pluginName: NORMAL_SELECTION_PLUGIN_NAME,
+ selections: [{ range, primary, style }],
+ show: false,
};
}
diff --git a/packages/ui-plugin-sheets/src/controller/format-painter/format-painter.controller.ts b/packages/ui-plugin-sheets/src/controller/format-painter/format-painter.controller.ts
index 931fd6ebfa..bca1648fe4 100644
--- a/packages/ui-plugin-sheets/src/controller/format-painter/format-painter.controller.ts
+++ b/packages/ui-plugin-sheets/src/controller/format-painter/format-painter.controller.ts
@@ -1,8 +1,8 @@
import { CURSOR_TYPE, IRenderManagerService } from '@univerjs/base-render';
import {
+ FORMAT_PAINTER_SELECTION_PLUGIN_NAME,
ISetRangeValuesCommandParams,
ISetSelectionsOperationParams,
- NORMAL_SELECTION_PLUGIN_NAME,
SelectionManagerService,
SetRangeValuesCommand,
SetSelectionsOperation,
@@ -58,7 +58,8 @@ export class FormatPainterController extends Disposable {
this._commandService.onCommandExecuted((command: ICommandInfo) => {
if (
command.id === SetSelectionsOperation.id &&
- (command.params as ISetSelectionsOperationParams)?.pluginName === NORMAL_SELECTION_PLUGIN_NAME
+ (command.params as ISetSelectionsOperationParams)?.pluginName ===
+ FORMAT_PAINTER_SELECTION_PLUGIN_NAME
) {
const isFormatPainterOn = this._formatPainterService.getStatus() !== FormatPainterStatus.OFF;
if (!isFormatPainterOn) return;
diff --git a/packages/ui-plugin-sheets/src/controller/menu/menu.ts b/packages/ui-plugin-sheets/src/controller/menu/menu.ts
index fa813446a7..981738107a 100644
--- a/packages/ui-plugin-sheets/src/controller/menu/menu.ts
+++ b/packages/ui-plugin-sheets/src/controller/menu/menu.ts
@@ -77,7 +77,7 @@ import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';
import { SHEET_UI_PLUGIN_NAME } from '../../Basics/Const/PLUGIN_NAME';
-import { RenameSheetCommand } from '../../commands/commands/rename.command';
+import { RenameSheetOperation } from '../../commands/commands/rename.command';
import {
SetInfiniteFormatPainterCommand,
SetOnceFormatPainterCommand,
@@ -1423,7 +1423,7 @@ export function CopySheetMenuItemFactory(): IMenuButtonItem {
export function RenameSheetMenuItemFactory(): IMenuButtonItem {
return {
- id: RenameSheetCommand.id,
+ id: RenameSheetOperation.id,
type: MenuItemType.BUTTON,
positions: [SheetMenuPosition.SHEET_BAR],
title: 'sheetConfig.rename',
diff --git a/packages/ui-plugin-sheets/src/controller/sheet-ui.controller.ts b/packages/ui-plugin-sheets/src/controller/sheet-ui.controller.ts
index 1564728307..d57a20569c 100644
--- a/packages/ui-plugin-sheets/src/controller/sheet-ui.controller.ts
+++ b/packages/ui-plugin-sheets/src/controller/sheet-ui.controller.ts
@@ -23,7 +23,7 @@ import { Inject, Injector } from '@wendellhu/redi';
import { connectInjector } from '@wendellhu/redi/react-bindings';
import { SHEET_UI_PLUGIN_NAME } from '../Basics';
-import { RenameSheetCommand } from '../commands/commands/rename.command';
+import { RenameSheetOperation } from '../commands/commands/rename.command';
import {
SetCopySelectionCommand,
SetInfiniteFormatPainterCommand,
@@ -85,7 +85,7 @@ import {
TextRotateMenuItemFactory,
UnderlineMenuItemFactory,
UndoMenuItemFactory,
- // UnHideSheetMenuItemFactory,
+ UnHideSheetMenuItemFactory,
VerticalAlignMenuItemFactory,
WrapTextMenuItemFactory,
} from './menu/menu';
@@ -164,7 +164,7 @@ export class SheetUIController extends Disposable {
SetFontSizeCommand,
ShowMenuListCommand,
- RenameSheetCommand,
+ RenameSheetOperation,
SetCellEditOperation,
@@ -240,7 +240,7 @@ export class SheetUIController extends Disposable {
RenameSheetMenuItemFactory,
ChangeColorSheetMenuItemFactory,
HideSheetMenuItemFactory,
- // UnHideSheetMenuItemFactory,
+ UnHideSheetMenuItemFactory,
] as IMenuItemFactory[]
).forEach((factory) => {
this.disposeWithMe(this._menuService.addMenuItem(this._injector.invoke(factory)));