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.

refactor: move ShortcutExperienceService to sheets-ui (#1193)

Wenzhao Hu7ff1dfe0c45f
diff --git a/packages/sheets-ui/src/commands/commands/__tests__/create-selection-command-test-bed.ts b/packages/sheets-ui/src/commands/commands/__tests__/create-selection-command-test-bed.ts
index 30810b5a1e..49e04bd02b 100644
--- a/packages/sheets-ui/src/commands/commands/__tests__/create-selection-command-test-bed.ts
+++ b/packages/sheets-ui/src/commands/commands/__tests__/create-selection-command-test-bed.ts
@@ -18,9 +18,9 @@ import type { IWorkbookData } from '@univerjs/core';
import { ICommandService, LocaleType } from '@univerjs/core';
import { SetFrozenMutation, SetSelectionsOperation } from '@univerjs/sheets';
import { createCommandTestBed } from '@univerjs/sheets/commands/commands/__tests__/create-command-test-bed.js';
-import { ShortcutExperienceService } from '@univerjs/ui';
import { ScrollManagerService } from '../../../services/scroll-manager.service';
+import { ShortcutExperienceService } from '../../../services/shortcut-experience.service';
import {
CancelFrozenCommand,
SetColumnFrozenCommand,
diff --git a/packages/sheets-ui/src/commands/commands/set-selection.command.ts b/packages/sheets-ui/src/commands/commands/set-selection.command.ts
index 24d6bd218c..00fce112fd 100644
--- a/packages/sheets-ui/src/commands/commands/set-selection.command.ts
+++ b/packages/sheets-ui/src/commands/commands/set-selection.command.ts
@@ -22,8 +22,9 @@ import {
SelectionManagerService,
SetSelectionsOperation,
} from '@univerjs/sheets';
-import { KeyCode, ShortcutExperienceService } from '@univerjs/ui';
+import { KeyCode } from '@univerjs/ui';
+import { ShortcutExperienceService } from '../../services/shortcut-experience.service';
import {
checkIfShrink,
expandToContinuousRange,
diff --git a/packages/ui/src/services/shortcut/shortcut-experience.service.ts b/packages/sheets-ui/src/services/shortcut-experience.service.ts
similarity index 98%
rename from packages/ui/src/services/shortcut/shortcut-experience.service.ts
rename to packages/sheets-ui/src/services/shortcut-experience.service.ts
index dc05376f30..cdcbfb99f3 100644
--- a/packages/ui/src/services/shortcut/shortcut-experience.service.ts
+++ b/packages/sheets-ui/src/services/shortcut-experience.service.ts
@@ -16,11 +16,10 @@
import type { ISelection, ITextRangeParam, Nullable } from '@univerjs/core';
import { IUniverInstanceService, LocaleService } from '@univerjs/core';
+import type { KeyCode } from '@univerjs/ui';
import type { IDisposable } from '@wendellhu/redi';
import { Inject } from '@wendellhu/redi';
-import type { KeyCode } from './keycode';
-
export interface IShortcutExperienceSearch {
unitId: string;
sheetId: string;
diff --git a/packages/sheets-ui/src/sheets-ui-plugin.ts b/packages/sheets-ui/src/sheets-ui-plugin.ts
index bd5548aa2d..294711cf37 100644
--- a/packages/sheets-ui/src/sheets-ui-plugin.ts
+++ b/packages/sheets-ui/src/sheets-ui-plugin.ts
@@ -61,6 +61,7 @@ import { ScrollManagerService } from './services/scroll-manager.service';
import { ISelectionRenderService, SelectionRenderService } from './services/selection/selection-render.service';
import { ISheetBarService, SheetBarService } from './services/sheet-bar/sheet-bar.service';
import { SheetSkeletonManagerService } from './services/sheet-skeleton-manager.service';
+import { ShortcutExperienceService } from './services/shortcut-experience.service';
import { IStatusBarService, StatusBarService } from './services/status-bar.service';
import { SheetCanvasView } from './views/sheet-canvas-view';
@@ -87,6 +88,7 @@ export class UniverSheetsUIPlugin extends Plugin {
[SheetCanvasView],
// services
+ [ShortcutExperienceService],
[IEditorBridgeService, { useClass: EditorBridgeService }],
[ISheetClipboardService, { useClass: SheetClipboardService }],
[ISheetBarService, { useClass: SheetBarService }],
diff --git a/packages/ui/src/index.ts b/packages/ui/src/index.ts
index 82d103fefb..85c6328b7f 100644
--- a/packages/ui/src/index.ts
+++ b/packages/ui/src/index.ts
@@ -69,7 +69,6 @@ export { INotificationService } from './services/notification/notification.servi
export { DesktopPlatformService, IPlatformService } from './services/platform/platform.service';
export { KeyCode, MetaKeys } from './services/shortcut/keycode';
export { DesktopShortcutService, type IShortcutItem, IShortcutService } from './services/shortcut/shortcut.service';
-export { ShortcutExperienceService } from './services/shortcut/shortcut-experience.service';
export { DesktopSidebarService } from './services/sidebar/desktop-sidebar.service';
export { ISidebarService } from './services/sidebar/sidebar.service';
export { IZenZoneService } from './services/zen-zone/zen-zone.service';
diff --git a/packages/ui/src/ui-plugin.ts b/packages/ui/src/ui-plugin.ts
index c7977b04ba..d5881fcf7d 100644
--- a/packages/ui/src/ui-plugin.ts
+++ b/packages/ui/src/ui-plugin.ts
@@ -44,7 +44,6 @@ import { DesktopNotificationService } from './services/notification/desktop-noti
import { INotificationService } from './services/notification/notification.service';
import { DesktopPlatformService, IPlatformService } from './services/platform/platform.service';
import { DesktopShortcutService, IShortcutService } from './services/shortcut/shortcut.service';
-import { ShortcutExperienceService } from './services/shortcut/shortcut-experience.service';
import { ShortcutPanelService } from './services/shortcut/shortcut-panel.service';
import { DesktopSidebarService } from './services/sidebar/desktop-sidebar.service';
import { ISidebarService } from './services/sidebar/sidebar.service';
@@ -94,7 +93,6 @@ export class UniverUIPlugin extends Plugin {
[ZIndexManager],
// services
- [ShortcutExperienceService],
[ShortcutPanelService],
[LayoutService],
[IShortcutService, { useClass: DesktopShortcutService }],