1
0
Fork 0
mirror of synced 2024-09-10 06:26:02 +12:00

Update keybindings to account for new copy/paste functions

This commit is contained in:
Andrew Kingston 2024-06-21 20:58:56 +01:00
parent 6633cc3cbc
commit 60d86c8b14
No known key found for this signature in database
2 changed files with 21 additions and 17 deletions

View file

@ -88,11 +88,12 @@
if (e.button !== 0) {
return
}
focusedCellId.set(cellId)
// focusedCellId.set(cellId)
cellSelection.actions.start(cellId)
}
const updateSelection = e => {
focusedCellId.set(null)
cellSelection.actions.update(cellId)
}
@ -115,6 +116,7 @@
on:mousedown={startSelection}
on:mouseenter={updateSelectionCallback}
on:mouseup={stopSelectionCallback}
on:click={() => focusedCellId.set(cellId)}
width={column.width}
>
<svelte:component

View file

@ -43,10 +43,23 @@
}
// 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 (e.metaKey || e.ctrlKey) {
switch (e.key) {
case "c":
e.preventDefault()
dispatch("copy")
return
case "v":
e.preventDefault()
dispatch("paste")
return
case "Enter":
e.preventDefault()
if ($config.canAddRows) {
dispatch("add-row-inline")
}
return
}
}
// If nothing selected avoid processing further key presses
@ -94,18 +107,7 @@
// Handle the key ourselves
if (e.metaKey || e.ctrlKey) {
switch (e.key) {
case "c":
dispatch("copy")
break
case "v":
dispatch("paste")
break
case "Enter":
if ($config.canAddRows) {
dispatch("add-row-inline")
}
}
//
} else {
switch (e.key) {
case "ArrowLeft":