Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.
TypeScript accessibilityalternativecloudflarecloudflare-workersdesignfreefrontendopen-sourceradix-uireactremixweb-developmentwebflowwebsite-builderwebsite-developmentwebsiteswebstudio
fix: on pasting in advanced panel, show warning toast for duplicate variables and continue updating the values (#5623)
Oleg Isonen315c848ddf65
diff --git a/apps/builder/app/builder/shared/css-editor/add-style-input.tsx b/apps/builder/app/builder/shared/css-editor/add-style-input.tsxindex 438e75a474..ce14a9a64c 100644--- a/apps/builder/app/builder/shared/css-editor/add-style-input.tsx+++ b/apps/builder/app/builder/shared/css-editor/add-style-input.tsx@@ -234,9 +234,16 @@ export const AddStyleInput = forwardRef<if (property.startsWith("--")) {const error = validateCssVariableName(property);if (error) {- // Show error via toast- toast.error(error.message);- return;+ // For duplicate variables, show warning and continue updating the values+ if (error.type === "duplicate") {+ toast.warn(+ `CSS variable "${property}" already exists. Its value will be updated.`+ );+ } else {+ // Show error via toast and block submission+ toast.error(error.message);+ return;+ }}}diff --git a/apps/builder/app/builder/shared/css-variable-utils.tsx b/apps/builder/app/builder/shared/css-variable-utils.tsxindex c7eb88690b..f8ee99897d 100644--- a/apps/builder/app/builder/shared/css-variable-utils.tsx+++ b/apps/builder/app/builder/shared/css-variable-utils.tsx@@ -270,7 +270,7 @@ export const $unusedCssVariables = computed(});-export type CssVariableError =+type CssVariableError =| { type: "required"; message: string }| { type: "invalid"; message: string }| { type: "duplicate"; message: string };