mirror of
https://github.com/purocean/yn.git
synced 2026-09-24 15:46:02 +08:00
feat: add focus to editor when toggling visibility
This commit is contained in:
@@ -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()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user