From 47e04c363c7f9894c387988a0063a86a4be19fde Mon Sep 17 00:00:00 2001 From: Dean Date: Wed, 10 Jan 2024 14:52:16 +0000 Subject: [PATCH 1/2] Disable eject for blocks if ejectable has been set to false --- .../_components/ComponentList/ComponentDropdownMenu.svelte | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/ComponentList/ComponentDropdownMenu.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/ComponentList/ComponentDropdownMenu.svelte index aeaa577455..052c06b213 100644 --- a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/ComponentList/ComponentDropdownMenu.svelte +++ b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/ComponentList/ComponentDropdownMenu.svelte @@ -7,6 +7,7 @@ $: definition = store.actions.components.getDefinition(component?._component) $: noPaste = !$store.componentToPaste $: isBlock = definition?.block === true + $: canEject = !(definition?.ejectable === false) const keyboardEvent = (key, ctrlKey = false) => { document.dispatchEvent( @@ -32,7 +33,7 @@ > Delete - {#if isBlock} + {#if isBlock && canEject} Date: Wed, 10 Jan 2024 15:38:49 +0000 Subject: [PATCH 2/2] Ignore calls to eject via keyboard shortcut ctrl+e is not an ejectable block --- .../ComponentList/ComponentKeyHandler.svelte | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/ComponentList/ComponentKeyHandler.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/ComponentList/ComponentKeyHandler.svelte index b6957f64f3..581dc31a05 100644 --- a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/ComponentList/ComponentKeyHandler.svelte +++ b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/ComponentList/ComponentKeyHandler.svelte @@ -32,8 +32,15 @@ await store.actions.components.paste(component, "below") }, ["Ctrl+e"]: component => { - componentToEject = component - confirmEjectDialog.show() + const definition = store.actions.components.getDefinition( + component._component + ) + const isBlock = definition?.block === true + const canEject = !(definition?.ejectable === false) + if (isBlock && canEject) { + componentToEject = component + confirmEjectDialog.show() + } }, ["Ctrl+Enter"]: () => { $goto(`./:componentId/new`)