From b9c685b83b6f4bc84a44d64e0b5895c01360efe0 Mon Sep 17 00:00:00 2001 From: Dean Date: Fri, 23 Aug 2024 10:15:46 +0100 Subject: [PATCH] Changed the CodeEditorModal to trigger a change when closing. This will accommodate any state updates to the editor --- .../SetupPanel/AutomationBlockSetup.svelte | 13 +++++++++++-- .../automation/SetupPanel/CodeEditorModal.svelte | 2 +- .../components/common/CodeEditor/CodeEditor.svelte | 1 + 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/packages/builder/src/components/automation/SetupPanel/AutomationBlockSetup.svelte b/packages/builder/src/components/automation/SetupPanel/AutomationBlockSetup.svelte index f48e5b9141..72eacfa0bb 100644 --- a/packages/builder/src/components/automation/SetupPanel/AutomationBlockSetup.svelte +++ b/packages/builder/src/components/automation/SetupPanel/AutomationBlockSetup.svelte @@ -1065,7 +1065,12 @@ value={inputData[key]} /> {:else if value.customType === "code"} - + { + // Push any pending changes when the window closes + onChange({ [key]: inputData[key] }) + }} + >
{ // need to pass without the value inside - onChange({ [key]: e.detail }) + inputData[key] = e.detail + }} + on:insert={e => { + // Blur events only happen once after inserting a binding + // State will now update on insert inputData[key] = e.detail }} completions={stepCompletions} diff --git a/packages/builder/src/components/automation/SetupPanel/CodeEditorModal.svelte b/packages/builder/src/components/automation/SetupPanel/CodeEditorModal.svelte index ce61af2b8c..92ced5dcc7 100644 --- a/packages/builder/src/components/automation/SetupPanel/CodeEditorModal.svelte +++ b/packages/builder/src/components/automation/SetupPanel/CodeEditorModal.svelte @@ -11,7 +11,7 @@ } - +