Update keybindings to account for new copy/paste functions
This commit is contained in:
parent
6633cc3cbc
commit
60d86c8b14
|
@ -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
|
||||
|
|
|
@ -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":
|
||||
|
|
Loading…
Reference in New Issue