From b6751233c384d0761c99658b493d5d631c7f8f05 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Thu, 28 Jul 2022 14:38:29 +0100 Subject: [PATCH] Prevent showing deletion modal for the screen element --- .../navigation/ComponentListPanel.svelte | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/navigation/ComponentListPanel.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/navigation/ComponentListPanel.svelte index e10015f964..76d5483be9 100644 --- a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/navigation/ComponentListPanel.svelte +++ b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/navigation/ComponentListPanel.svelte @@ -90,12 +90,24 @@ const component = get(selectedComponent) try { if (e.key === "Delete") { + // Don't show confirmation for the screen itself + if (component._id === get(selectedScreen).props._id) { + return + } e.preventDefault() confirmDeleteDialog.show() + } else if (e.key === "ArrowUp") { + e.preventDefault() + await store.actions.components.selectPrevious() + } else if (e.key === "ArrowDown") { + e.preventDefault() + await store.actions.components.selectNext() + } else if (e.key === "Escape" && $isActive("./new")) { + e.preventDefault() + $goto("./") } else if (e.ctrlKey) { if (e.key === "ArrowUp") { e.preventDefault() - e.stopPropagation() await store.actions.components.moveUp(component) } else if (e.key === "ArrowDown") { e.preventDefault() @@ -113,15 +125,6 @@ e.preventDefault() $goto("./new") } - } else if (e.key === "ArrowUp") { - e.preventDefault() - await store.actions.components.selectPrevious() - } else if (e.key === "ArrowDown") { - e.preventDefault() - await store.actions.components.selectNext() - } else if (e.key === "Escape" && $isActive("./new")) { - e.preventDefault() - $goto("./") } } catch (error) { console.log(error)