Skip to content

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.

fix: Text stroke (#5585)

Oleg Isonen169fabb05188
diff --git a/apps/builder/app/builder/shared/css-editor/parse-style-input.test.ts b/apps/builder/app/builder/shared/css-editor/parse-style-input.test.ts
index 776a343960..abbf4245f7 100644
--- a/apps/builder/app/builder/shared/css-editor/parse-style-input.test.ts
+++ b/apps/builder/app/builder/shared/css-editor/parse-style-input.test.ts
@@ -94,4 +94,22 @@ describe("parseStyleInput", () => {
new Map([["rotate", { type: "invalid", value: "z 0" }]])
);
});
+
+ test("preserves -webkit-text-stroke as shorthand property, not as CSS variable", () => {
+ const result = parseStyleInput("-webkit-text-stroke: 1px red");
+ expect(result).toEqual(
+ new Map([
+ [
+ "-webkit-text-stroke",
+ {
+ type: "tuple",
+ value: [
+ { type: "unit", unit: "px", value: 1 },
+ { type: "keyword", value: "red" },
+ ],
+ },
+ ],
+ ])
+ );
+ });
});
diff --git a/apps/builder/app/builder/shared/css-editor/parse-style-input.ts b/apps/builder/app/builder/shared/css-editor/parse-style-input.ts
index 68e193697c..816dd681c6 100644
--- a/apps/builder/app/builder/shared/css-editor/parse-style-input.ts
+++ b/apps/builder/app/builder/shared/css-editor/parse-style-input.ts
@@ -51,7 +51,13 @@ export const parseStyleInput = (css: string): CssStyleMap => {
continue;
}
// somethingunknown: red; -> --somethingunknown: red;
- if (propertiesData[property] === undefined) {
+ // but keep known shorthands like -webkit-text-stroke as-is
+ if (
+ propertiesData[property] === undefined &&
+ shorthandProperties.includes(
+ property as (typeof shorthandProperties)[number]
+ ) === false
+ ) {
styleMap.set(`--${property}`, value);
continue;
}