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 (!$focusedCellId) {
|
||||
if (e.key === "Tab" || e.key?.startsWith("Arrow")) {
|
||||
e.preventDefault()
|
||||
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") {
|
||||
if (Object.keys($selectedRows).length && $config.canDeleteRows) {
|
||||
dispatch("request-bulk-delete")
|
||||
|
|
Loading…
Reference in New Issue