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(shortcut): fix delete drawing shortcut (#6401)

wpxp123456203f7cbc0136
diff --git a/packages/docs-drawing-ui/src/controllers/shortcuts/drawing.shortcut.ts b/packages/docs-drawing-ui/src/controllers/shortcuts/drawing.shortcut.ts
index 2702685761..dafae39b90 100644
--- a/packages/docs-drawing-ui/src/controllers/shortcuts/drawing.shortcut.ts
+++ b/packages/docs-drawing-ui/src/controllers/shortcuts/drawing.shortcut.ts
@@ -17,13 +17,14 @@
import type { IContextService } from '@univerjs/core';
import type { IShortcutItem } from '@univerjs/ui';
import type { IMoveDrawingsCommandParams } from '../../commands/commands/move-drawings.command';
-import { Direction, FOCUSING_COMMON_DRAWINGS, FOCUSING_UNIVER_EDITOR } from '@univerjs/core';
+import { Direction, FOCUSING_COMMON_DRAWINGS, FOCUSING_DOC, FOCUSING_UNIVER_EDITOR } from '@univerjs/core';
import { KeyCode } from '@univerjs/ui';
import { DeleteDocDrawingsCommand } from '../../commands/commands/delete-doc-drawing.command';
import { MoveDocDrawingsCommand } from '../../commands/commands/move-drawings.command';
export function whenDocDrawingFocused(contextService: IContextService): boolean {
return (
+ contextService.getContextValue(FOCUSING_DOC) &&
contextService.getContextValue(FOCUSING_UNIVER_EDITOR) &&
contextService.getContextValue(FOCUSING_COMMON_DRAWINGS)
);
diff --git a/packages/sheets-drawing-ui/src/controllers/shortcuts/drawing.shortcut.ts b/packages/sheets-drawing-ui/src/controllers/shortcuts/drawing.shortcut.ts
index 1c7439de2b..ef16e02e07 100644
--- a/packages/sheets-drawing-ui/src/controllers/shortcuts/drawing.shortcut.ts
+++ b/packages/sheets-drawing-ui/src/controllers/shortcuts/drawing.shortcut.ts
@@ -17,13 +17,14 @@
import type { IContextService } from '@univerjs/core';
import type { IShortcutItem } from '@univerjs/ui';
import type { IMoveDrawingsCommandParams } from '../../commands/commands/move-drawings.command';
-import { Direction, EDITOR_ACTIVATED, FOCUSING_COMMON_DRAWINGS, FOCUSING_FX_BAR_EDITOR, FOCUSING_PANEL_EDITOR } from '@univerjs/core';
+import { Direction, EDITOR_ACTIVATED, FOCUSING_COMMON_DRAWINGS, FOCUSING_FX_BAR_EDITOR, FOCUSING_PANEL_EDITOR, FOCUSING_SHEET } from '@univerjs/core';
import { KeyCode } from '@univerjs/ui';
import { DeleteDrawingsCommand } from '../../commands/commands/delete-drawings.command';
import { MoveDrawingsCommand } from '../../commands/commands/move-drawings.command';
export function whenSheetDrawingFocused(contextService: IContextService): boolean {
return (
+ contextService.getContextValue(FOCUSING_SHEET) &&
!contextService.getContextValue(FOCUSING_FX_BAR_EDITOR) &&
!contextService.getContextValue(EDITOR_ACTIVATED) &&
!contextService.getContextValue(FOCUSING_PANEL_EDITOR) &&