Skip to content

Commit d2f2445

Browse files
committed
fix(editor): fist screen empty, close #58
1 parent ee323e7 commit d2f2445

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

packages/client/logic/shortcuts.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { Fn, not, and, whenever } from '@vueuse/core'
2-
import { fullscreen, magicKeys, shortcutsEnabled, isInputing, toggleOverview, showGotoDialog, showOverview } from '../state'
2+
import { fullscreen, magicKeys, shortcutsEnabled, isInputing, toggleOverview, showGotoDialog, showOverview, isOnFocus } from '../state'
33
import { toggleDark } from './dark'
44
import { next, nextSlide, prev, prevSlide } from './nav'
55

6-
const _shortcut = and(not(isInputing), shortcutsEnabled)
6+
const _shortcut = and(not(isInputing), not(isOnFocus), shortcutsEnabled)
77

88
export function shortcut(key: string, fn: Fn) {
99
return whenever(and(magicKeys[key], _shortcut), fn, { flush: 'sync' })

packages/client/state/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ export const isScreenVertical = computed(() => windowSize.width.value <= windowS
1515
export const fullscreen = useFullscreen(isClient ? document.body : null)
1616

1717
export const activeElement = useActiveElement()
18-
export const isInputing = computed(() => ['INPUT', 'TEXTAREA', 'BUTTON', 'A'].includes(activeElement.value?.tagName || '') || activeElement.value?.classList.contains('CodeMirror-code'))
18+
export const isInputing = computed(() => ['INPUT', 'TEXTAREA'].includes(activeElement.value?.tagName || '') || activeElement.value?.classList.contains('CodeMirror-code'))
19+
export const isOnFocus = computed(() => ['BUTTON', 'A'].includes(activeElement.value?.tagName || ''))
1920

2021
export const currentCamera = useStorage<string>('slidev-camera', 'default')
2122
export const currentMic = useStorage<string>('slidev-mic', 'default')

0 commit comments

Comments
 (0)