From b8fb6d9667587fb7a95955714d6dc78b219cdc36 Mon Sep 17 00:00:00 2001 From: purocean Date: Wed, 3 Jul 2024 11:54:49 +0800 Subject: [PATCH] feat: add focus to editor when toggling visibility --- src/renderer/services/layout.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/renderer/services/layout.ts b/src/renderer/services/layout.ts index b14b263e..8d750278 100644 --- a/src/renderer/services/layout.ts +++ b/src/renderer/services/layout.ts @@ -6,6 +6,7 @@ import { Alt } from '@fe/core/keybinding' import store from '@fe/support/store' import * as view from './view' import { t } from './i18n' +import { getEditor } from './editor' const emitResizeDebounce = throttle(() => { triggerHook('GLOBAL_RESIZE') @@ -60,6 +61,12 @@ export function toggleEditor (visible?: boolean) { store.state.showView = true } + if (val) { + Promise.resolve().then(() => { + getEditor().focus() + }) + } + emitResize() }