diff --git a/frontend/src/lib/components/apps/editor/AppEditor.svelte b/frontend/src/lib/components/apps/editor/AppEditor.svelte index c6608ddbe3..172f5cc60e 100644 --- a/frontend/src/lib/components/apps/editor/AppEditor.svelte +++ b/frontend/src/lib/components/apps/editor/AppEditor.svelte @@ -158,144 +158,148 @@ /> {/if} {#if !$userStore?.operator} - {#if initialMode !== 'preview'} - - {/if} + {#if $appStore} + {#if initialMode !== 'preview'} + + {/if} - {#if previewing} - -
- -
-
- {:else} - - - - - - - - - -
{ - $selectedComponent = undefined - $focusedGrid = undefined - }} - class={twMerge( - 'bg-gray-100 h-full w-full', - $appStore.css?.['app']?.['viewer']?.class - )} - style={$appStore.css?.['app']?.['viewer']?.style} - > + {#if previewing} + +
+ +
+
+ {:else} + + + + + + + + +
{ + $selectedComponent = undefined + $focusedGrid = undefined + }} + class={twMerge( + 'bg-gray-100 h-full w-full', + $appStore.css?.['app']?.['viewer']?.class )} + style={$appStore.css?.['app']?.['viewer']?.style} > - {#if $appStore.grid} - +
+ {#if $appStore.grid} + -
- +
+ +
+ +
+ {/if} +
+
+ + +
+ +
+
+ + + + +
+ + +
+ + Insert +
+
+ +
+ + Settings +
+
+ +
+ + CSS +
+
+
+ + {#if $selectedComponent !== undefined} + + {:else} +
+ Select a component to see the settings for it
- -
{/if} -
+
+ + + + + +
- - -
- -
-
- - - - -
- - -
- - Insert -
-
- -
- - Settings -
-
- -
- - CSS -
-
-
- - {#if $selectedComponent !== undefined} - - {:else} -
- Select a component to see the settings for it + + {#if $connectingInput.opened} +
+ +
+ Click on the output of the component you want to connect to on the left panel. +
+ +
- {/if} - - - - - - - -
- - {#if $connectingInput.opened} -
- -
- Click on the output of the component you want to connect to on the left panel. -
- -
-
-
-
- {/if} -
- - - + +
+ {/if} +
+
+ + + {/if} + {:else} + App is null {/if} {:else} App editor not available to operators diff --git a/frontend/src/lib/components/apps/editor/AppEditorHeader.svelte b/frontend/src/lib/components/apps/editor/AppEditorHeader.svelte index 1d31dfec09..945cab6a19 100644 --- a/frontend/src/lib/components/apps/editor/AppEditorHeader.svelte +++ b/frontend/src/lib/components/apps/editor/AppEditorHeader.svelte @@ -18,6 +18,7 @@ import DisplayResult from '$lib/components/DisplayResult.svelte' import Dropdown from '$lib/components/Dropdown.svelte' import FlowProgressBar from '$lib/components/flows/FlowProgressBar.svelte' + import { idMutex } from '$lib/components/flows/flowStateUtils' import FlowStatusViewer from '$lib/components/FlowStatusViewer.svelte' import JobArgs from '$lib/components/JobArgs.svelte' import LogViewer from '$lib/components/LogViewer.svelte' @@ -247,7 +248,10 @@ $: selectedJobId && testJobLoader?.watchJob(selectedJobId) $: hasErrors = Object.keys($errorByComponent).length > 0 + let lock = false function onKeyDown(event: KeyboardEvent) { + if (lock) return + lock = true switch (event.key) { case 'Z': if (event.ctrlKey) { @@ -258,6 +262,7 @@ case 'z': if (event.ctrlKey) { $app = undo(history, $app) + event.preventDefault() } break @@ -286,6 +291,7 @@ // break // } } + lock = false } @@ -513,20 +519,22 @@
{#if $focusedGrid !== undefined} diff --git a/frontend/src/lib/components/apps/editor/appUtils.ts b/frontend/src/lib/components/apps/editor/appUtils.ts index 2d6cac5e77..be82c52c4d 100644 --- a/frontend/src/lib/components/apps/editor/appUtils.ts +++ b/frontend/src/lib/components/apps/editor/appUtils.ts @@ -309,7 +309,6 @@ export function expandGriditem( ) { const availableSpace = findAvailableSpace(grid, gridComponent, $breakpoint, parentGridItem) - console.log(availableSpace) if (!availableSpace) { return } diff --git a/frontend/src/lib/history.ts b/frontend/src/lib/history.ts index 983228d32c..703f8b5ef4 100644 --- a/frontend/src/lib/history.ts +++ b/frontend/src/lib/history.ts @@ -21,7 +21,13 @@ export function undo(history: History | undefined, now: T): T { }) } let nhistory = get(history) - return nhistory.history[nhistory.index] + let r = nhistory.history[nhistory.index] + if (!r) { + console.log('undo failed', nhistory, now) + return now + } else { + return r + } } else { return now }