Fix requiring double keypress to create new rows
This commit is contained in:
parent
3788d67e8d
commit
f458ae20a9
|
@ -40,16 +40,18 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Handle certain key presses regardless of selection state
|
||||||
|
if (e.key === "Enter" && (e.ctrlKey || e.metaKey) && $config.canAddRows) {
|
||||||
|
e.preventDefault()
|
||||||
|
dispatch("add-row-inline")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// If nothing selected avoid processing further key presses
|
// If nothing selected avoid processing further key presses
|
||||||
if (!$focusedCellId) {
|
if (!$focusedCellId) {
|
||||||
if (e.key === "Tab" || e.key?.startsWith("Arrow")) {
|
if (e.key === "Tab" || e.key?.startsWith("Arrow")) {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
focusFirstCell()
|
focusFirstCell()
|
||||||
} else if (e.key === "Enter" && (e.ctrlKey || e.metaKey)) {
|
|
||||||
if ($config.canAddRows) {
|
|
||||||
e.preventDefault()
|
|
||||||
dispatch("add-row-inline")
|
|
||||||
}
|
|
||||||
} else if (e.key === "Delete" || e.key === "Backspace") {
|
} else if (e.key === "Delete" || e.key === "Backspace") {
|
||||||
if (Object.keys($selectedRows).length && $config.canDeleteRows) {
|
if (Object.keys($selectedRows).length && $config.canDeleteRows) {
|
||||||
dispatch("request-bulk-delete")
|
dispatch("request-bulk-delete")
|
||||||
|
|
Loading…
Reference in New Issue