diff --git a/packages/builder/src/builderStore/store/frontend.js b/packages/builder/src/builderStore/store/frontend.js
index ec810e5c31..333e74bd60 100644
--- a/packages/builder/src/builderStore/store/frontend.js
+++ b/packages/builder/src/builderStore/store/frontend.js
@@ -575,6 +575,14 @@ export const getFrontendStore = () => {
})
await store.actions.preview.saveSelected()
},
+ ejectBlock: async (id, definition) => {
+ const asset = get(currentAsset)
+ let parent = findComponentParent(asset.props, id)
+ const childIndex = parent._children.findIndex(x => x._id === id)
+ parent._children[childIndex] = definition
+ await store.actions.preview.saveSelected()
+ await store.actions.components.select(definition)
+ },
},
links: {
save: async (url, title) => {
diff --git a/packages/builder/src/components/design/AppPreview/CurrentItemPreview.svelte b/packages/builder/src/components/design/AppPreview/CurrentItemPreview.svelte
index 706550cca7..1b5bbb1dbc 100644
--- a/packages/builder/src/components/design/AppPreview/CurrentItemPreview.svelte
+++ b/packages/builder/src/components/design/AppPreview/CurrentItemPreview.svelte
@@ -202,6 +202,9 @@
block: "center",
})
}
+ } else if (type === "eject-block") {
+ const { id, definition } = data
+ await store.actions.components.ejectBlock(id, definition)
} else {
console.warn(`Client sent unknown event type: ${type}`)
}
diff --git a/packages/builder/src/components/design/NavigationPanel/ComponentNavigationTree/ComponentDropdownMenu.svelte b/packages/builder/src/components/design/NavigationPanel/ComponentNavigationTree/ComponentDropdownMenu.svelte
index ae031e14bd..43306d309d 100644
--- a/packages/builder/src/components/design/NavigationPanel/ComponentNavigationTree/ComponentDropdownMenu.svelte
+++ b/packages/builder/src/components/design/NavigationPanel/ComponentNavigationTree/ComponentDropdownMenu.svelte
@@ -12,6 +12,7 @@
$: definition = store.actions.components.getDefinition(component?._component)
$: noChildrenAllowed = !component || !definition?.hasChildren
$: noPaste = !$store.componentToPaste
+ $: isBlock = definition?.block === true
// "editable" has been repurposed for inline text editing.
// It remains here for legacy compatibility.
@@ -83,6 +84,8 @@
notifications.error("Error saving component")
}
}
+
+ const ejectBlock = () => {}
{#if showMenu}
@@ -93,6 +96,9 @@
+ {#if isBlock}
+
+ {/if}
diff --git a/packages/client/src/components/Block.svelte b/packages/client/src/components/Block.svelte
index b5e610c1bb..5605ebb711 100644
--- a/packages/client/src/components/Block.svelte
+++ b/packages/client/src/components/Block.svelte
@@ -1,12 +1,65 @@