From 2c85e33b38b7ae5d0ae7f8e456a244ff4fda09fa Mon Sep 17 00:00:00 2001 From: Josh Knapp Date: Wed, 7 Oct 2026 10:00:29 -0700 Subject: [PATCH] fix(site-builder): continuous-edit bursts via history.merge; plain setters are single steps Refs #32 Co-Authored-By: Claude Sonnet 5.5 --- .../panels/right/styles/ArrayItemFields.tsx | 12 +- .../styles/BackgroundSectionStylePanel.tsx | 10 +- .../panels/right/styles/ButtonStylePanel.tsx | 18 +-- .../right/styles/ContainerStylePanel.tsx | 12 +- .../panels/right/styles/FeaturesEditor.tsx | 12 +- .../panels/right/styles/FormStylePanel.tsx | 38 +++--- .../styles/FormStylePanel.webhook.test.tsx | 2 +- .../right/styles/GenericPropsEditor.tsx | 12 +- .../panels/right/styles/HeroStylePanel.tsx | 30 ++--- .../panels/right/styles/HtmlStylePanel.tsx | 4 +- .../right/styles/ImageStylePanel.test.tsx | 2 +- .../panels/right/styles/ImageStylePanel.tsx | 24 ++-- .../panels/right/styles/MediaStylePanel.tsx | 34 +++--- .../styles/MediaStylePanel.video.test.tsx | 2 +- .../right/styles/NavStylePanel.test.tsx | 2 +- .../src/panels/right/styles/NavStylePanel.tsx | 28 ++--- .../panels/right/styles/PricingStylePanel.tsx | 32 ++--- .../panels/right/styles/SectionTypePanel.tsx | 18 +-- .../panels/right/styles/SocialStylePanel.tsx | 46 +++---- .../panels/right/styles/TextStylePanel.tsx | 12 +- craft/src/panels/right/styles/shared.tsx | 62 ++++++++-- .../undo-steps.integration.test.tsx | 115 ++++++++++++++---- 22 files changed, 316 insertions(+), 211 deletions(-) diff --git a/craft/src/panels/right/styles/ArrayItemFields.tsx b/craft/src/panels/right/styles/ArrayItemFields.tsx index 056101e..7551b9a 100644 --- a/craft/src/panels/right/styles/ArrayItemFields.tsx +++ b/craft/src/panels/right/styles/ArrayItemFields.tsx @@ -1,6 +1,6 @@ import React, { useEffect, useRef } from 'react'; import { useEditor } from '@craftjs/core'; -import { CollapsibleSection, ArrayPropEditor, smallInputStyle, TYPING_THROTTLE_MS } from './shared'; +import { CollapsibleSection, ArrayPropEditor, smallInputStyle, continuousSetProp } from './shared'; import { useLayerFocus } from '../../left/LayerFocusContext'; /* ---------- Shared array-item field editor ---------- @@ -52,7 +52,7 @@ export const ArrayItemFieldsEditor: React.FC<{ selectedId: string; propKey: stri data-array-item={`${propKey}:${index}`} value={String(item)} onChange={(e) => { - actions.history.throttle(TYPING_THROTTLE_MS).setProp(selectedId, (props: any) => { + continuousSetProp(actions, selectedId, `${propKey}:${index}`, (props: any) => { const updated = [...(props[propKey] || [])]; updated[index] = e.target.value; props[propKey] = updated; @@ -85,7 +85,7 @@ export const ArrayItemFieldsEditor: React.FC<{ selectedId: string; propKey: stri
{ - actions.history.throttle(TYPING_THROTTLE_MS).setProp(selectedId, (props: any) => { + continuousSetProp(actions, selectedId, `${propKey}:${index}:${field}`, (props: any) => { const updated = [...(props[propKey] || [])]; updated[index] = { ...updated[index], [field]: parseFloat(e.target.value) || 0 }; props[propKey] = updated; @@ -100,7 +100,7 @@ export const ArrayItemFieldsEditor: React.FC<{ selectedId: string; propKey: stri
{ - actions.history.throttle(TYPING_THROTTLE_MS).setProp(selectedId, (props: any) => { + continuousSetProp(actions, selectedId, `${propKey}:${index}:${field}`, (props: any) => { const updated = [...(props[propKey] || [])]; updated[index] = { ...updated[index], [field]: e.target.value }; props[propKey] = updated; @@ -117,7 +117,7 @@ export const ArrayItemFieldsEditor: React.FC<{ selectedId: string; propKey: stri {isLongField ? (