feat: add focus to editor when toggling visibility

This commit is contained in:
purocean
2024-07-03 11:54:49 +08:00
parent 56c726c9ca
commit b8fb6d9667
+7
View File
@@ -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()
}