Merge pull request #12755 from Budibase/fix/disable-component-tree-eject-per-config

Disable eject option for blocks in the component tree when ejectable set to false in manifest
This commit is contained in:
deanhannigan 2024-01-10 15:47:41 +00:00 committed by GitHub
commit 64c3cd4aa0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 3 deletions

View File

@ -7,6 +7,7 @@
$: definition = store.actions.components.getDefinition(component?._component) $: definition = store.actions.components.getDefinition(component?._component)
$: noPaste = !$store.componentToPaste $: noPaste = !$store.componentToPaste
$: isBlock = definition?.block === true $: isBlock = definition?.block === true
$: canEject = !(definition?.ejectable === false)
const keyboardEvent = (key, ctrlKey = false) => { const keyboardEvent = (key, ctrlKey = false) => {
document.dispatchEvent( document.dispatchEvent(
@ -32,7 +33,7 @@
> >
Delete Delete
</MenuItem> </MenuItem>
{#if isBlock} {#if isBlock && canEject}
<MenuItem <MenuItem
icon="Export" icon="Export"
keyBind="Ctrl+E" keyBind="Ctrl+E"

View File

@ -32,8 +32,15 @@
await store.actions.components.paste(component, "below") await store.actions.components.paste(component, "below")
}, },
["Ctrl+e"]: component => { ["Ctrl+e"]: component => {
const definition = store.actions.components.getDefinition(
component._component
)
const isBlock = definition?.block === true
const canEject = !(definition?.ejectable === false)
if (isBlock && canEject) {
componentToEject = component componentToEject = component
confirmEjectDialog.show() confirmEjectDialog.show()
}
}, },
["Ctrl+Enter"]: () => { ["Ctrl+Enter"]: () => {
$goto(`./:componentId/new`) $goto(`./:componentId/new`)