Skip to content

Commit

Permalink
fix(editor): fist screen empty, close #58
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed May 11, 2021
1 parent ee323e7 commit d2f2445
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions packages/client/logic/shortcuts.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Fn, not, and, whenever } from '@vueuse/core'
import { fullscreen, magicKeys, shortcutsEnabled, isInputing, toggleOverview, showGotoDialog, showOverview } from '../state'
import { fullscreen, magicKeys, shortcutsEnabled, isInputing, toggleOverview, showGotoDialog, showOverview, isOnFocus } from '../state'
import { toggleDark } from './dark'
import { next, nextSlide, prev, prevSlide } from './nav'

const _shortcut = and(not(isInputing), shortcutsEnabled)
const _shortcut = and(not(isInputing), not(isOnFocus), shortcutsEnabled)

export function shortcut(key: string, fn: Fn) {
return whenever(and(magicKeys[key], _shortcut), fn, { flush: 'sync' })
Expand Down
3 changes: 2 additions & 1 deletion packages/client/state/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ export const isScreenVertical = computed(() => windowSize.width.value <= windowS
export const fullscreen = useFullscreen(isClient ? document.body : null)

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

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

0 comments on commit d2f2445

Please sign in to comment.