diff --git a/frontend/src/builder.d.ts b/frontend/src/builder.d.ts index e6474767..6fed9990 100644 --- a/frontend/src/builder.d.ts +++ b/frontend/src/builder.d.ts @@ -53,6 +53,7 @@ declare interface ContextMenuOption { label: string; action: CallableFunction; condition?: () => boolean; + disabled?: () => boolean; } declare interface ComponentData { diff --git a/frontend/src/components/BlockContextMenu.vue b/frontend/src/components/BlockContextMenu.vue index 270dd0a8..06ac5d2a 100644 --- a/frontend/src/components/BlockContextMenu.vue +++ b/frontend/src/components/BlockContextMenu.vue @@ -143,12 +143,6 @@ const contextMenuOptions: ContextMenuOption[] = [ return selectedBlocks.every((block: Block) => block.getParentBlock() === parentBlock); }, }, - { - label: "Save As Component", - action: () => (showNewComponentDialog.value = true), - condition: () => !block.value.isExtendedFromComponent(), - }, - { label: "Repeat Block", action: () => { @@ -166,7 +160,8 @@ const contextMenuOptions: ContextMenuOption[] = [ }, { label: "Reset Overrides", - condition: () => block.value.hasOverrides(store.activeBreakpoint), + condition: () => store.activeBreakpoint !== "desktop", + disabled: () => !block.value?.hasOverrides(store.activeBreakpoint), action: () => { block.value.resetOverrides(store.activeBreakpoint); }, @@ -216,6 +211,11 @@ const contextMenuOptions: ContextMenuOption[] = [ }, condition: () => !block.value.isExtendedFromComponent() && Boolean(window.is_developer_mode), }, + { + label: "Save As Component", + action: () => (showNewComponentDialog.value = true), + condition: () => !block.value.isExtendedFromComponent(), + }, { label: "Detach Component", action: () => { diff --git a/frontend/src/components/ContextMenu.vue b/frontend/src/components/ContextMenu.vue index 88130a37..788aa676 100644 --- a/frontend/src/components/ContextMenu.vue +++ b/frontend/src/components/ContextMenu.vue @@ -7,6 +7,7 @@
{{ option.label }}
@@ -28,12 +29,6 @@ import { computed, ref } from "vue"; const menu = ref(null) as unknown as typeof Menu; -interface ContextMenuOption { - label: string; - action: CallableFunction; - condition?: () => boolean; -} - const props = defineProps({ posX: { type: Number, diff --git a/frontend/src/components/PageClientScriptManager.vue b/frontend/src/components/PageClientScriptManager.vue index e0c4c117..bb98903f 100644 --- a/frontend/src/components/PageClientScriptManager.vue +++ b/frontend/src/components/PageClientScriptManager.vue @@ -140,7 +140,6 @@ const selectScript = (script: attachedScript) => { }; const updateScript = (value: string) => { - console.log(value); if (!activeScript.value) return; clientScriptResource.setValue .submit({