Skip to content

Commit

Permalink
chore(editor): swap ctrl to alt
Browse files Browse the repository at this point in the history
  • Loading branch information
Novout committed Oct 23, 2021
1 parent f77931a commit e4c9cba
Showing 1 changed file with 39 additions and 30 deletions.
69 changes: 39 additions & 30 deletions src/components/editor/entity/EditorEntityShow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -480,36 +480,11 @@
const onKeyboard = async (e: KeyboardEvent) => {
const _input = input.value as HTMLTextAreaElement
// in ctrl press
if (e.ctrlKey) {
// generics
if (e.key !== 'c' && e.key !== 'f' && e.key !== 'a' && e.key !== 'v') {
e.preventDefault()
e.stopPropagation()
}
// finder
if (e.key === 'f') {
ABSOLUTE.shortcuts.finder = !ABSOLUTE.shortcuts.finder
}
// swapper
if (e.key === 'h') {
ABSOLUTE.shortcuts.finder = !ABSOLUTE.shortcuts.switcher
}
// delete entity
if (e.key === 'd') {
emitter.emit('entity-not-mutate', props.entity)
await nextTick
CONTEXT.removeInPage(props.entity)
await nextTick
PROJECT.updateContext(CONTEXT.$state)
} else if (e.key === 'ArrowUp') {
if (e.altKey) {
e.preventDefault()
e.stopPropagation()
if (e.key === 'ArrowUp') {
// to up
onUpdateContent()
Expand Down Expand Up @@ -558,6 +533,40 @@
switch: true,
})
}
return
}
// in ctrl press
if (e.ctrlKey) {
// generics
if (e.key !== 'c' && e.key !== 'f' && e.key !== 'a' && e.key !== 'v') {
e.preventDefault()
e.stopPropagation()
}
// finder
if (e.key === 'f') {
ABSOLUTE.shortcuts.finder = !ABSOLUTE.shortcuts.finder
}
// swapper
if (e.key === 'h') {
ABSOLUTE.shortcuts.finder = !ABSOLUTE.shortcuts.switcher
}
// delete entity
if (e.key === 'd') {
emitter.emit('entity-not-mutate', props.entity)
await nextTick
CONTEXT.removeInPage(props.entity)
await nextTick
PROJECT.updateContext(CONTEXT.$state)
}
} else {
// delete in empty raw or convert
if (
Expand Down

0 comments on commit e4c9cba

Please sign in to comment.