Allow native paste into table cells
This commit is contained in:
parent
fc21c80d64
commit
691d6b04bb
|
@ -2,9 +2,16 @@
|
|||
import { Modal, ModalContent, ProgressBar } from "@budibase/bbui"
|
||||
import { getContext, onMount } from "svelte"
|
||||
import { sleep } from "../../../utils/utils"
|
||||
import { get } from "svelte/store"
|
||||
|
||||
const { clipboard, subscribe, copyAllowed, pasteAllowed, selectedCellCount } =
|
||||
getContext("grid")
|
||||
const {
|
||||
clipboard,
|
||||
subscribe,
|
||||
copyAllowed,
|
||||
pasteAllowed,
|
||||
selectedCellCount,
|
||||
focusedCellAPI,
|
||||
} = getContext("grid")
|
||||
const duration = 260
|
||||
|
||||
let modal
|
||||
|
@ -19,10 +26,15 @@
|
|||
}
|
||||
|
||||
const handlePasteRequest = async () => {
|
||||
// If a cell is active then let the native paste action take over
|
||||
if (get(focusedCellAPI)?.isActive()) {
|
||||
return
|
||||
}
|
||||
progressPercentage = 0
|
||||
if (!$pasteAllowed) {
|
||||
return
|
||||
}
|
||||
|
||||
// Prompt if paste will update multiple cells
|
||||
const multiCellPaste = $selectedCellCount > 1
|
||||
const prompt = $clipboard.multiCellCopy || multiCellPaste
|
||||
|
|
|
@ -58,7 +58,7 @@
|
|||
case "c":
|
||||
return handle(() => dispatch("copy"))
|
||||
case "v":
|
||||
return handle(() => dispatch("paste"))
|
||||
return dispatch("paste")
|
||||
case "Enter":
|
||||
return handle(() => {
|
||||
if ($config.canAddRows) {
|
||||
|
|
Loading…
Reference in New Issue