Fix keybinding order precendence

This commit is contained in:
Andrew Kingston 2022-07-29 11:52:54 +01:00
parent e83543151e
commit 4158513bf4
1 changed files with 17 additions and 17 deletions

View File

@ -89,23 +89,7 @@
} }
const component = get(selectedComponent) const component = get(selectedComponent)
try { try {
if (e.key === "Delete") { if (e.ctrlKey) {
// Don't show confirmation for the screen itself
if (component._id === get(selectedScreen).props._id) {
return
}
e.preventDefault()
confirmDeleteDialog.show()
} else if (e.key === "ArrowUp") {
e.preventDefault()
await store.actions.components.selectPrevious()
} else if (e.key === "ArrowDown") {
e.preventDefault()
await store.actions.components.selectNext()
} else if (e.key === "Escape" && $isActive("./new")) {
e.preventDefault()
$goto("./")
} else if (e.ctrlKey) {
if (e.key === "ArrowUp") { if (e.key === "ArrowUp") {
e.preventDefault() e.preventDefault()
await store.actions.components.moveUp(component) await store.actions.components.moveUp(component)
@ -125,6 +109,22 @@
e.preventDefault() e.preventDefault()
$goto("./new") $goto("./new")
} }
} else if (e.key === "Delete") {
// Don't show confirmation for the screen itself
if (component._id === get(selectedScreen).props._id) {
return
}
e.preventDefault()
confirmDeleteDialog.show()
} else if (e.key === "ArrowUp") {
e.preventDefault()
await store.actions.components.selectPrevious()
} else if (e.key === "ArrowDown") {
e.preventDefault()
await store.actions.components.selectNext()
} else if (e.key === "Escape" && $isActive("./new")) {
e.preventDefault()
$goto("./")
} }
} catch (error) { } catch (error) {
console.log(error) console.log(error)