1
0
Fork 0
mirror of synced 2024-09-20 19:33:10 +12:00

Allow native paste into table cells

This commit is contained in:
Andrew Kingston 2024-08-08 12:18:06 +01:00
parent fc21c80d64
commit 691d6b04bb
No known key found for this signature in database
2 changed files with 15 additions and 3 deletions

View file

@ -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

View file

@ -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) {