diff --git a/packages/ui/src/services/layout/layout.service.ts b/packages/ui/src/services/layout/layout.service.ts index 9f5718a391e..b82a71e00f6 100644 --- a/packages/ui/src/services/layout/layout.service.ts +++ b/packages/ui/src/services/layout/layout.service.ts @@ -149,7 +149,7 @@ export class DesktopLayoutService extends Disposable implements ILayoutService { fromEvent(window, 'focusin').subscribe((event) => { const target = event.target as HTMLElement; if (collectionOfCnForFocusableEle.some((item) => target.classList.contains(item))) { - this._editorService.blur(); + this._editorBlurListener(); queueMicrotask(() => this.focus()); return; } @@ -172,6 +172,13 @@ export class DesktopLayoutService extends Disposable implements ILayoutService { getFocusingUniverEditorStatus() ); } + + private _editorBlurListener() { + const focusEditor = this._editorService.getFocusEditor(); + if (focusEditor && focusEditor.isSheetEditor() !== true) { + this._editorService.blur(); + } + } } function getFocusingUniverEditorStatus(): boolean {