Disable pasting for readonly cells

This commit is contained in:
Andrew Kingston 2023-04-21 10:57:45 +01:00
parent aa98cf72f5
commit f8a9af2458
2 changed files with 5 additions and 2 deletions

View File

@ -54,7 +54,9 @@
clipboard.actions.copy() clipboard.actions.copy()
break break
case "v": case "v":
clipboard.actions.paste() if (!api?.isReadonly()) {
clipboard.actions.paste()
}
break break
} }
} else { } else {

View File

@ -13,6 +13,7 @@
copiedCell, copiedCell,
clipboard, clipboard,
dispatch, dispatch,
focusedCellAPI,
} = getContext("grid") } = getContext("grid")
$: style = makeStyle($menu) $: style = makeStyle($menu)
@ -49,7 +50,7 @@
</MenuItem> </MenuItem>
<MenuItem <MenuItem
icon="Paste" icon="Paste"
disabled={$copiedCell == null} disabled={$copiedCell == null || $focusedCellAPI?.isReadonly()}
on:click={clipboard.actions.paste} on:click={clipboard.actions.paste}
on:click={menu.actions.close} on:click={menu.actions.close}
> >