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:
commit
64c3cd4aa0
|
@ -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"
|
||||||
|
|
|
@ -32,8 +32,15 @@
|
||||||
await store.actions.components.paste(component, "below")
|
await store.actions.components.paste(component, "below")
|
||||||
},
|
},
|
||||||
["Ctrl+e"]: component => {
|
["Ctrl+e"]: component => {
|
||||||
componentToEject = component
|
const definition = store.actions.components.getDefinition(
|
||||||
confirmEjectDialog.show()
|
component._component
|
||||||
|
)
|
||||||
|
const isBlock = definition?.block === true
|
||||||
|
const canEject = !(definition?.ejectable === false)
|
||||||
|
if (isBlock && canEject) {
|
||||||
|
componentToEject = component
|
||||||
|
confirmEjectDialog.show()
|
||||||
|
}
|
||||||
},
|
},
|
||||||
["Ctrl+Enter"]: () => {
|
["Ctrl+Enter"]: () => {
|
||||||
$goto(`./:componentId/new`)
|
$goto(`./:componentId/new`)
|
||||||
|
|
Loading…
Reference in New Issue