Fix keyboard shortcuts circumventing disabling adding rows

This commit is contained in:
Andrew Kingston 2023-04-28 11:32:44 +01:00
parent 80da2fb93a
commit 96fc70f29a
2 changed files with 10 additions and 4 deletions

View File

@ -130,7 +130,9 @@
<GridBody />
</div>
<BetaButton />
<NewRow />
{#if allowAddRows}
<NewRow />
{/if}
<div class="overlays">
<ResizeOverlay />
<ReorderOverlay />

View File

@ -38,8 +38,10 @@
e.preventDefault()
focusFirstCell()
} else if (e.key === "Enter" && (e.ctrlKey || e.metaKey)) {
e.preventDefault()
dispatch("add-row-inline")
if ($config.allowAddRows) {
e.preventDefault()
dispatch("add-row-inline")
}
} else if (e.key === "Delete" || e.key === "Backspace") {
if (Object.keys($selectedRows).length && $config.allowDeleteRows) {
dispatch("request-bulk-delete")
@ -89,7 +91,9 @@
}
break
case "Enter":
dispatch("add-row-inline")
if ($config.allowAddRows) {
dispatch("add-row-inline")
}
}
} else {
switch (e.key) {