Skip to content

Commit

Permalink
feat: add focusing-editor context value for chart panel (#3996)
Browse files Browse the repository at this point in the history
  • Loading branch information
yuhongz authored Nov 8, 2024
1 parent fe6c0b2 commit 80167a1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 3 additions & 0 deletions packages/core/src/services/context/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
);
}
Expand Down

0 comments on commit 80167a1

Please sign in to comment.