diff --git a/apps/builder/app/builder/shared/css-editor/css-editor.tsx b/apps/builder/app/builder/shared/css-editor/css-editor.tsx index 1900fa0e6885..77bf4fc60433 100644 --- a/apps/builder/app/builder/shared/css-editor/css-editor.tsx +++ b/apps/builder/app/builder/shared/css-editor/css-editor.tsx @@ -340,7 +340,7 @@ export const CssEditor = ({ }, })); - const advancedProperties = Array.from(styleMap.keys()) as Array; + const advancedProperties = Array.from(styleMap.keys()); const currentProperties = searchProperties ?? @@ -394,7 +394,7 @@ export const CssEditor = ({ keys: ["property", "value"], }).map(({ property }) => property); - setSearchProperties(matched as CssProperty[]); + setSearchProperties(matched); }; const afterChangingStyles = () => { @@ -407,6 +407,25 @@ export const CssEditor = ({ }); }; + const handleDeleteProperty: DeleteProperty = (property, options = {}) => { + onDeleteProperty(property, options); + if (options.isEphemeral === true) { + return; + } + setSearchProperties( + searchProperties?.filter((searchProperty) => searchProperty !== property) + ); + }; + + const handleDeleteAllDeclarations = (styleMap: CssStyleMap) => { + setSearchProperties( + searchProperties?.filter( + (searchProperty) => styleMap.has(searchProperty) === false + ) + ); + onDeleteAllDeclarations(styleMap); + }; + return ( <> {showSearch && ( @@ -420,8 +439,8 @@ export const CssEditor = ({ )} ); @@ -493,7 +512,7 @@ export const CssEditor = ({