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.

feat: add focusing-editor context value for chart panel (#3996)

YuHong80167a1f7a1c
diff --git a/packages/core/src/services/context/context.ts b/packages/core/src/services/context/context.ts
index a2e960edae..94d2ebd2ff 100644
--- a/packages/core/src/services/context/context.ts
+++ b/packages/core/src/services/context/context.ts
@@ -41,6 +41,9 @@ export const FOCUSING_UNIVER_EDITOR = 'FOCUSING_UNIVER_EDITOR';
export const FOCUSING_EDITOR_STANDALONE = 'FOCUSING_EDITOR_INPUT_FORMULA';
+/** The focusing state of the editor in side panel, such as Chart Editor Panel. */
+export const FOCUSING_PANEL_EDITOR = 'FOCUSING_PANEL_EDITOR';
+
// WTF: what does this even means?
export const FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE = 'FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE';
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 2abac03652..95c428e683 100644
--- a/packages/sheets-drawing-ui/src/controllers/shortcuts/drawing.shortcut.ts
+++ b/packages/sheets-drawing-ui/src/controllers/shortcuts/drawing.shortcut.ts
@@ -15,16 +15,17 @@
*/
import type { IContextService } from '@univerjs/core';
-import { Direction, EDITOR_ACTIVATED, FOCUSING_COMMON_DRAWINGS, FOCUSING_FX_BAR_EDITOR } from '@univerjs/core';
import type { IShortcutItem } from '@univerjs/ui';
+import { Direction, EDITOR_ACTIVATED, FOCUSING_COMMON_DRAWINGS, FOCUSING_FX_BAR_EDITOR, FOCUSING_PANEL_EDITOR } from '@univerjs/core';
import { KeyCode } from '@univerjs/ui';
-import { type IMoveDrawingsCommandParams, MoveDrawingsCommand } from '../../commands/commands/move-drawings.command';
import { DeleteDrawingsCommand } from '../../commands/commands/delete-drawings.command';
+import { type IMoveDrawingsCommandParams, MoveDrawingsCommand } from '../../commands/commands/move-drawings.command';
export function whenSheetDrawingFocused(contextService: IContextService): boolean {
return (
!contextService.getContextValue(FOCUSING_FX_BAR_EDITOR) &&
!contextService.getContextValue(EDITOR_ACTIVATED) &&
+ !contextService.getContextValue(FOCUSING_PANEL_EDITOR) &&
contextService.getContextValue(FOCUSING_COMMON_DRAWINGS)
);
}