Update keybindings to account for new copy/paste functions
This commit is contained in:
parent
6633cc3cbc
commit
60d86c8b14
2 changed files with 21 additions and 17 deletions
|
@ -88,11 +88,12 @@
|
||||||
if (e.button !== 0) {
|
if (e.button !== 0) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
focusedCellId.set(cellId)
|
// focusedCellId.set(cellId)
|
||||||
cellSelection.actions.start(cellId)
|
cellSelection.actions.start(cellId)
|
||||||
}
|
}
|
||||||
|
|
||||||
const updateSelection = e => {
|
const updateSelection = e => {
|
||||||
|
focusedCellId.set(null)
|
||||||
cellSelection.actions.update(cellId)
|
cellSelection.actions.update(cellId)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,6 +116,7 @@
|
||||||
on:mousedown={startSelection}
|
on:mousedown={startSelection}
|
||||||
on:mouseenter={updateSelectionCallback}
|
on:mouseenter={updateSelectionCallback}
|
||||||
on:mouseup={stopSelectionCallback}
|
on:mouseup={stopSelectionCallback}
|
||||||
|
on:click={() => focusedCellId.set(cellId)}
|
||||||
width={column.width}
|
width={column.width}
|
||||||
>
|
>
|
||||||
<svelte:component
|
<svelte:component
|
||||||
|
|
|
@ -43,10 +43,23 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle certain key presses regardless of selection state
|
// Handle certain key presses regardless of selection state
|
||||||
if (e.key === "Enter" && (e.ctrlKey || e.metaKey) && $config.canAddRows) {
|
if (e.metaKey || e.ctrlKey) {
|
||||||
e.preventDefault()
|
switch (e.key) {
|
||||||
dispatch("add-row-inline")
|
case "c":
|
||||||
return
|
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
|
// If nothing selected avoid processing further key presses
|
||||||
|
@ -94,18 +107,7 @@
|
||||||
|
|
||||||
// Handle the key ourselves
|
// Handle the key ourselves
|
||||||
if (e.metaKey || e.ctrlKey) {
|
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 {
|
} else {
|
||||||
switch (e.key) {
|
switch (e.key) {
|
||||||
case "ArrowLeft":
|
case "ArrowLeft":
|
||||||
|
|
Loading…
Reference in a new issue