From a304aae95c13188e1cfcc46afe1ff745adb762e5 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Wed, 30 Mar 2022 09:32:19 +0100 Subject: [PATCH] Only save textContent of editable fields to fix HTML being inserted, and fully remount component when toggling editing to fix chrome issues --- packages/client/manifest.json | 2 - .../client/src/components/app/Button.svelte | 55 ++++++++++--------- .../client/src/components/app/Heading.svelte | 31 ++++++----- .../client/src/components/app/Link.svelte | 2 +- .../client/src/components/app/Text.svelte | 31 ++++++----- .../src/components/app/forms/Field.svelte | 24 ++++---- 6 files changed, 75 insertions(+), 70 deletions(-) diff --git a/packages/client/manifest.json b/packages/client/manifest.json index 037ceec996..4c3c0faf1f 100644 --- a/packages/client/manifest.json +++ b/packages/client/manifest.json @@ -2529,7 +2529,6 @@ "name": "Embedded Map", "icon": "Location", "styles": ["size"], - "editable": true, "draggable": false, "illegalChildren": ["section"], "settings": [ @@ -3631,7 +3630,6 @@ "name": "Markdown Viewer", "icon": "TaskList", "styles": ["size"], - "editable": true, "settings": [ { "type": "text", diff --git a/packages/client/src/components/app/Button.svelte b/packages/client/src/components/app/Button.svelte index 18bb935edb..7d11ba74bb 100644 --- a/packages/client/src/components/app/Button.svelte +++ b/packages/client/src/components/app/Button.svelte @@ -22,41 +22,44 @@ $: componentText = getComponentText(text, $builderStore, $component) const getComponentText = (text, builderState, componentState) => { - if (!builderState.inBuilder || componentState.editing) { + if (componentState.editing) { return text || " " } return text || componentState.name || "Placeholder text" } const updateText = e => { - builderStore.actions.updateProp("text", e.target.textContent.trim()) + builderStore.actions.updateProp("text", e.target.textContent) } - +{#key $component.editing} + +{/key}