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
feat: support text-wrap (#3620)
Bogdan Chadkin6ec8aaeeb7a0
diff --git a/apps/builder/app/builder/features/style-panel/sections/typography/typography.tsx b/apps/builder/app/builder/features/style-panel/sections/typography/typography.tsxindex d42601f80a..c85b48aad8 100644--- a/apps/builder/app/builder/features/style-panel/sections/typography/typography.tsx+++ b/apps/builder/app/builder/features/style-panel/sections/typography/typography.tsx@@ -1,3 +1,4 @@+import { forwardRef, type ComponentProps } from "react";import {Flex,Grid,@@ -37,7 +38,6 @@ import { ToggleGroupControl } from "../../controls/toggle-group/toggle-group-conimport { FloatingPanel } from "~/builder/shared/floating-panel";import { getStyleSourceColor, type StyleInfo } from "../../shared/style-info";import { CollapsibleSection } from "../../shared/collapsible-section";-import { forwardRef, type ComponentProps } from "react";export const properties = ["fontFamily",@@ -51,7 +51,9 @@ export const properties = ["letterSpacing","textTransform","direction",- "whiteSpace",+ "whiteSpaceCollapse",+ "textWrapMode",+ "textWrapStyle","textOverflow","hyphens",] satisfies Array<StyleProperty>;@@ -352,7 +354,9 @@ export const TypographySectionAdvancedPopover = (props: SectionProps) => {const { deleteProperty, setProperty, createBatchUpdate, currentStyle } =props;const properties = {- whiteSpace: "whiteSpace",+ whiteSpaceCollapse: "whiteSpaceCollapse",+ textWrapMode: "textWrapMode",+ textWrapStyle: "textWrapStyle",direction: "direction",hyphens: "hyphens",textOverflow: "textOverflow",@@ -372,12 +376,41 @@ export const TypographySectionAdvancedPopover = (props: SectionProps) => {<Grid css={{ gridTemplateColumns: "4fr 6fr" }} gap={2}><PropertyNamestyle={currentStyle}- properties={[properties.whiteSpace]}+ properties={[properties.whiteSpaceCollapse]}label="White Space"- onReset={() => deleteProperty(properties.whiteSpace)}+ onReset={() => deleteProperty(properties.whiteSpaceCollapse)}+ />+ <SelectControl+ property={properties.whiteSpaceCollapse}+ currentStyle={currentStyle}+ setProperty={setProperty}+ deleteProperty={deleteProperty}+ />+ </Grid>+ {/* @todo cannot set because not supported in browser ??? */}+ <Grid css={{ gridTemplateColumns: "4fr 6fr" }} gap={2}>+ <PropertyName+ style={currentStyle}+ properties={[properties.textWrapMode]}+ label="Wrap Mode"+ onReset={() => deleteProperty(properties.textWrapMode)}+ />+ <SelectControl+ property={properties.textWrapMode}+ currentStyle={currentStyle}+ setProperty={setProperty}+ deleteProperty={deleteProperty}+ />+ </Grid>+ <Grid css={{ gridTemplateColumns: "4fr 6fr" }} gap={2}>+ <PropertyName+ style={currentStyle}+ properties={[properties.textWrapStyle]}+ label="Wrap Style"+ onReset={() => deleteProperty(properties.textWrapStyle)}/><SelectControl- property={properties.whiteSpace}+ property={properties.textWrapStyle}currentStyle={currentStyle}setProperty={setProperty}deleteProperty={deleteProperty}diff --git a/apps/builder/app/shared/webstudio-data-migrator.ts b/apps/builder/app/shared/webstudio-data-migrator.tsindex a9c34c000e..3035f4f82c 100644--- a/apps/builder/app/shared/webstudio-data-migrator.ts+++ b/apps/builder/app/shared/webstudio-data-migrator.ts@@ -4,7 +4,11 @@ import {type StyleDecl,type WebstudioData,} from "@webstudio-is/sdk";-import { toValue, type StyleProperty } from "@webstudio-is/css-engine";+import {+ hyphenateProperty,+ toValue,+ type StyleProperty,+} from "@webstudio-is/css-engine";import { expandShorthands, parseCssValue } from "@webstudio-is/css-data";/**@@ -21,11 +25,16 @@ import { expandShorthands, parseCssValue } from "@webstudio-is/css-data";*/export const migrateWebstudioDataMutable = (data: WebstudioData) => {for (const [styleDeclKey, styleDecl] of data.styles) {- const property = styleDecl.property as string;+ const property = hyphenateProperty(styleDecl.property);// expands overflow shorthand into overflow-x and overflow-y longhands// expands transition shorthand into transition-property, transition-duration, transition-timing-function, transition-delay longhands- if (property === "overflow" || property === "transition") {+ // expands white-space into white-space-collapse and text-wrap-mode+ if (+ property === "overflow" ||+ property === "transition" ||+ property === "white-space"+ ) {data.styles.delete(styleDeclKey);const longhands = expandShorthands([[property, toValue(styleDecl.value)],diff --git a/packages/css-data/bin/mdn-data.ts b/packages/css-data/bin/mdn-data.tsindex 43298ea126..c3eff9cc1f 100755--- a/packages/css-data/bin/mdn-data.ts+++ b/packages/css-data/bin/mdn-data.ts@@ -242,12 +242,8 @@ const unsupportedProperties = ["font-synthesis","font-variant","overflow",- // @todo for now webstudio supports only white-space- // need to figure out how to make it future proof- "white-space-collapse",+ "white-space","text-wrap",- "text-wrap-mode",- "text-wrap-style",];const animatableProperties: string[] = [];diff --git a/packages/css-data/src/__generated__/keyword-values.ts b/packages/css-data/src/__generated__/keyword-values.tsindex 5b16a44a24..94ab987995 100644--- a/packages/css-data/src/__generated__/keyword-values.ts+++ b/packages/css-data/src/__generated__/keyword-values.ts@@ -4845,6 +4845,16 @@ export const keywordValues = {"inherit","unset",],+ textWrapMode: ["auto", "wrap", "nowrap", "initial", "inherit", "unset"],+ textWrapStyle: [+ "auto",+ "balance",+ "stable",+ "pretty",+ "initial",+ "inherit",+ "unset",+ ],top: ["auto", "initial", "inherit", "unset"],touchAction: ["auto",@@ -4934,22 +4944,13 @@ export const keywordValues = {"unset",],visibility: ["visible", "hidden", "collapse", "initial", "inherit", "unset"],- whiteSpace: [- "normal",- "pre",- "nowrap",- "pre-wrap",- "pre-line",- "break-spaces",+ whiteSpaceCollapse: ["collapse","discard","preserve","preserve-breaks","preserve-spaces",- "wrap",- "balance",- "stable",- "pretty",+ "break-spaces","initial","inherit","unset",diff --git a/packages/css-data/src/__generated__/properties.ts b/packages/css-data/src/__generated__/properties.tsindex c8c936ed73..786ab8c359 100644--- a/packages/css-data/src/__generated__/properties.ts+++ b/packages/css-data/src/__generated__/properties.ts@@ -2819,6 +2819,24 @@ export const properties = {},types: [],},+ textWrapMode: {+ unitGroups: [],+ inherited: true,+ initial: {+ type: "keyword",+ value: "wrap",+ },+ types: [],+ },+ textWrapStyle: {+ unitGroups: [],+ inherited: true,+ initial: {+ type: "keyword",+ value: "auto",+ },+ types: [],+ },top: {unitGroups: ["length", "percentage"],inherited: false,@@ -2972,12 +2990,12 @@ export const properties = {},types: [],},- whiteSpace: {+ whiteSpaceCollapse: {unitGroups: [],inherited: true,initial: {type: "keyword",- value: "normal",+ value: "collapse",},types: [],},diff --git a/packages/css-data/src/html.ts b/packages/css-data/src/html.tsindex 8790e35ed6..882a033448 100644--- a/packages/css-data/src/html.ts+++ b/packages/css-data/src/html.ts@@ -91,8 +91,13 @@ const verticalAlign = (value: string): Styles[number] => ({value: { type: "keyword", value },});-const whiteSpace = (value: string): Styles[number] => ({- property: "whiteSpace",+const whiteSpaceCollapse = (value: string): Styles[number] => ({+ property: "whiteSpaceCollapse",+ value: { type: "keyword", value },+});++const textWrapMode = (value: string): Styles[number] => ({+ property: "textWrapMode",value: { type: "keyword", value },});@@ -283,7 +288,8 @@ export const h6: Styles = [export const pre: Styles = [display("block"),- whiteSpace("pre"),+ whiteSpaceCollapse("preserve"),+ textWrapMode("nowrap"),marginTop(1, "em"),marginBottom(1, "em"),];@@ -548,7 +554,8 @@ export const textarea: Styles = [verticalAlign("text-bottom"),cursor("text"),{ property: "resize", value: { type: "keyword", value: "both" } },- whiteSpace("pre-wrap"),+ whiteSpaceCollapse("preserve"),+ textWrapMode("wrap"),{property: "wordWrap",value: { type: "keyword", value: "break-word" },@@ -569,7 +576,7 @@ export const select: Styles = [...borderWidth(2, "px"),// in browsers defined as inset...borderStyle("solid"),- whiteSpace("nowrap"),+ textWrapMode("nowrap"),{property: "wordWrap",value: { type: "keyword", value: "normal" },@@ -592,7 +599,7 @@ export const option: Styles = [paddingRight(2, "px"),paddingLeft(4, "px"),userSelect("none"),- whiteSpace("nowrap"),+ textWrapMode("nowrap"),{property: "wordWrap",value: { type: "keyword", value: "normal" },diff --git a/packages/css-data/src/parse-css-value.ts b/packages/css-data/src/parse-css-value.tsindex 08e26609ab..c36b78d825 100644--- a/packages/css-data/src/parse-css-value.ts+++ b/packages/css-data/src/parse-css-value.ts@@ -35,6 +35,25 @@ export const isValidDeclaration = (): boolean => {const cssPropertyName = hyphenateProperty(property);+ // these properties have poor support natively and in csstree+ // though rendered styles are merged as shorthand+ // so validate artifically+ if (cssPropertyName === "white-space-collapse") {+ return keywordValues.whiteSpaceCollapse.includes(+ value as (typeof keywordValues.whiteSpaceCollapse)[0]+ );+ }+ if (cssPropertyName === "text-wrap-mode") {+ return keywordValues.textWrapMode.includes(+ value as (typeof keywordValues.textWrapMode)[0]+ );+ }+ if (cssPropertyName === "text-wrap-style") {+ return keywordValues.textWrapStyle.includes(+ value as (typeof keywordValues.textWrapStyle)[0]+ );+ }+// @todo remove after csstree fixes// - https://github.com/csstree/csstree/issues/246// - https://github.com/csstree/csstree/issues/164diff --git a/packages/css-data/src/shorthands.test.ts b/packages/css-data/src/shorthands.test.tsindex 23b433165b..a1228a0f49 100644--- a/packages/css-data/src/shorthands.test.ts+++ b/packages/css-data/src/shorthands.test.ts@@ -979,8 +979,79 @@ test("expand contain-intrinsic-size", () => {]);});-test.todo("white-space - not a shorthand in webflow");-test.todo("text-wrap - not a shorthand in webflow");+test("expand white-space", () => {+ expect(expandShorthands([["white-space", "normal"]])).toEqual([+ ["white-space-collapse", "collapse"],+ ["text-wrap-mode", "wrap"],+ ]);+ expect(expandShorthands([["white-space", "pre"]])).toEqual([+ ["white-space-collapse", "preserve"],+ ["text-wrap-mode", "nowrap"],+ ]);+ expect(expandShorthands([["white-space", "pre-wrap"]])).toEqual([+ ["white-space-collapse", "preserve"],+ ["text-wrap-mode", "wrap"],+ ]);+ expect(expandShorthands([["white-space", "pre-line"]])).toEqual([+ ["white-space-collapse", "preserve-breaks"],+ ["text-wrap-mode", "wrap"],+ ]);+ // white-space-collapse values+ expect(expandShorthands([["white-space", "collapse"]])).toEqual([+ ["white-space-collapse", "collapse"],+ ["text-wrap-mode", "wrap"],+ ]);+ expect(expandShorthands([["white-space", "preserve"]])).toEqual([+ ["white-space-collapse", "preserve"],+ ["text-wrap-mode", "wrap"],+ ]);+ expect(expandShorthands([["white-space", "preserve-breaks"]])).toEqual([+ ["white-space-collapse", "preserve-breaks"],+ ["text-wrap-mode", "wrap"],+ ]);+ expect(expandShorthands([["white-space", "preserve-spaces"]])).toEqual([+ ["white-space-collapse", "preserve-spaces"],+ ["text-wrap-mode", "wrap"],+ ]);+ expect(expandShorthands([["white-space", "break-spaces"]])).toEqual([+ ["white-space-collapse", "break-spaces"],+ ["text-wrap-mode", "wrap"],+ ]);+ // text-wrap-mode values+ expect(expandShorthands([["white-space", "wrap"]])).toEqual([+ ["white-space-collapse", "collapse"],+ ["text-wrap-mode", "wrap"],+ ]);+ expect(expandShorthands([["white-space", "nowrap"]])).toEqual([+ ["white-space-collapse", "collapse"],+ ["text-wrap-mode", "nowrap"],+ ]);+});++test("expand text-wrap", () => {+ // text-wrap-mode values+ expect(expandShorthands([["text-wrap", "wrap"]])).toEqual([+ ["text-wrap-mode", "wrap"],+ ["text-wrap-style", "auto"],+ ]);+ expect(expandShorthands([["text-wrap", "nowrap"]])).toEqual([+ ["text-wrap-mode", "nowrap"],+ ["text-wrap-style", "auto"],+ ]);+ // text-wrap-style values+ expect(expandShorthands([["text-wrap", "balance"]])).toEqual([+ ["text-wrap-mode", "wrap"],+ ["text-wrap-style", "balance"],+ ]);+ expect(expandShorthands([["text-wrap", "stable"]])).toEqual([+ ["text-wrap-mode", "wrap"],+ ["text-wrap-style", "stable"],+ ]);+ expect(expandShorthands([["text-wrap", "pretty"]])).toEqual([+ ["text-wrap-mode", "wrap"],+ ["text-wrap-style", "pretty"],+ ]);+});test.todo("all - can negatively affect build size");test.todo("background - not used in webflow");diff --git a/packages/css-data/src/shorthands.ts b/packages/css-data/src/shorthands.tsindex 3797005b19..5649d3c796 100644--- a/packages/css-data/src/shorthands.ts+++ b/packages/css-data/src/shorthands.ts@@ -850,6 +850,38 @@ const expandGrid = function* (value: CssNode) {yield ["grid-auto-columns", autoColumns] as const;};+const expandWhiteSpace = function* (value: CssNode) {+ const collapseKeyword = createIdentifier("collapse");+ const preserveKeyword = createIdentifier("preserve");+ const wrapKeyword = createIdentifier("wrap");+ const nowrapKeyword = createIdentifier("nowrap");+ let collapse = collapseKeyword;+ let wrapMode = wrapKeyword;+ [collapse = collapseKeyword, wrapMode = wrapKeyword] = parseUnordered(+ [+ // <'white-space-collapse'> is not supported by csstree+ "collapse | preserve | preserve-breaks | preserve-spaces | break-spaces",+ // <'text-wrap-mode'> is not supported by csstree+ "wrap | nowrap",+ ],+ value+ );+ if (lexer.match("normal", value).matched) {+ [collapse, wrapMode] = [collapseKeyword, wrapKeyword];+ }+ if (lexer.match("pre", value).matched) {+ [collapse, wrapMode] = [preserveKeyword, nowrapKeyword];+ }+ if (lexer.match("pre-wrap", value).matched) {+ [collapse, wrapMode] = [preserveKeyword, wrapKeyword];+ }+ if (lexer.match("pre-line", value).matched) {+ [collapse, wrapMode] = [createIdentifier("preserve-breaks"), wrapKeyword];+ }+ yield ["white-space-collapse", collapse] as const;+ yield ["text-wrap-mode", wrapMode] as const;+};+const expandShorthand = function* (property: string, value: CssNode) {switch (property) {case "font":@@ -1123,6 +1155,28 @@ const expandShorthand = function* (property: string, value: CssNode) {break;}+ case "white-space":+ yield* expandWhiteSpace(value);+ break;++ case "text-wrap": {+ const [+ mode = createIdentifier("wrap"),+ style = createIdentifier("auto"),+ ] = parseUnordered(+ [+ // <'text-wrap-mode'> is not supported by csstree+ "wrap | nowrap",+ // <'text-wrap-style'> is not supported by csstree+ "auto | balance | stable | pretty",+ ],+ value+ );+ yield ["text-wrap-mode", mode] as const;+ yield ["text-wrap-style", style] as const;+ break;+ }+default:yield [property, value] as const;}diff --git a/packages/css-engine/src/__generated__/types.ts b/packages/css-engine/src/__generated__/types.tsindex 98df161460..64e37c6e22 100644--- a/packages/css-engine/src/__generated__/types.ts+++ b/packages/css-engine/src/__generated__/types.ts@@ -300,6 +300,8 @@ export type Property =| "textTransform"| "textUnderlineOffset"| "textUnderlinePosition"+ | "textWrapMode"+ | "textWrapStyle"| "top"| "touchAction"| "transform"@@ -315,7 +317,7 @@ export type Property =| "userSelect"| "verticalAlign"| "visibility"- | "whiteSpace"+ | "whiteSpaceCollapse"| "widows"| "width"| "willChange"diff --git a/packages/css-engine/src/core/merger.test.ts b/packages/css-engine/src/core/merger.test.tsindex e57959f845..ed299b6277 100644--- a/packages/css-engine/src/core/merger.test.ts+++ b/packages/css-engine/src/core/merger.test.ts@@ -160,3 +160,135 @@ test("merge border longhands", () => {)).toEqual([["border", "1px solid red"]]);});++const mergeKeywords = (list: [property: string, keyword: string][]) => {+ const styleMap: StyleMap = new Map();+ for (const [property, value] of list) {+ styleMap.set(property, { type: "keyword", value });+ }+ return toStringMap(mergeStyles(styleMap));+};++test("merge white-space-collapse and text-wrap-mode into white-space", () => {+ expect(+ mergeKeywords([+ ["white-space-collapse", "collapse"],+ ["text-wrap-mode", "wrap"],+ ])+ ).toEqual([+ ["white-space", "normal"],+ ["white-space-collapse", "collapse"],+ ]);+ expect(+ mergeKeywords([+ ["white-space-collapse", "collapse"],+ ["text-wrap-mode", "nowrap"],+ ])+ ).toEqual([+ ["white-space", "nowrap"],+ ["white-space-collapse", "collapse"],+ ]);+ expect(+ mergeKeywords([+ ["white-space-collapse", "preserve"],+ ["text-wrap-mode", "nowrap"],+ ])+ ).toEqual([+ ["white-space", "pre"],+ ["white-space-collapse", "preserve"],+ ]);+ expect(+ mergeKeywords([+ ["white-space-collapse", "preserve"],+ ["text-wrap-mode", "wrap"],+ ])+ ).toEqual([+ ["white-space", "pre-wrap"],+ ["white-space-collapse", "preserve"],+ ]);+ expect(+ mergeKeywords([+ ["white-space-collapse", "preserve-breaks"],+ ["text-wrap-mode", "wrap"],+ ])+ ).toEqual([+ ["white-space", "pre-line"],+ ["white-space-collapse", "preserve-breaks"],+ ]);+ expect(+ mergeKeywords([+ ["white-space-collapse", "preserve-spaces"],+ ["text-wrap-mode", "wrap"],+ ])+ ).toEqual([+ ["white-space", "normal"],+ ["white-space-collapse", "preserve-spaces"],+ ]);+});++test("merge white-space with vars", () => {+ expect(+ toStringMap(+ mergeStyles(+ new Map([+ [+ "white-space-collapse",+ { type: "var", value: "collapse", fallbacks: [] },+ ],+ ])+ )+ )+ ).toEqual([["white-space-collapse", "var(--collapse)"]]);+});++test("merge text-wrap-mode and text-wrap-style into text-wrap", () => {+ expect(+ mergeKeywords([+ ["text-wrap-mode", "wrap"],+ ["text-wrap-style", "balance"],+ ])+ ).toEqual([+ ["white-space", "normal"],+ ["text-wrap", "balance"],+ ]);+ expect(+ mergeKeywords([+ ["text-wrap-mode", "wrap"],+ ["text-wrap-style", "stable"],+ ])+ ).toEqual([+ ["white-space", "normal"],+ ["text-wrap", "stable"],+ ]);+ expect(+ mergeKeywords([+ ["text-wrap-mode", "wrap"],+ ["text-wrap-style", "pretty"],+ ])+ ).toEqual([+ ["white-space", "normal"],+ ["text-wrap", "pretty"],+ ]);+});++test("merge text-wrap with vars", () => {+ expect(+ toStringMap(+ mergeStyles(+ new Map([+ ["text-wrap-mode", { type: "var", value: "mode", fallbacks: [] }],+ ["text-wrap-style", { type: "var", value: "style", fallbacks: [] }],+ ])+ )+ )+ ).toEqual([["text-wrap", "var(--style)"]]);+ expect(+ toStringMap(+ mergeStyles(+ new Map([+ ["text-wrap-style", { type: "var", value: "style", fallbacks: [] }],+ ])+ )+ )+ ).toEqual([["text-wrap", "var(--style)"]]);+});diff --git a/packages/css-engine/src/core/merger.ts b/packages/css-engine/src/core/merger.tsindex 8e2751990f..ce7110ffe3 100644--- a/packages/css-engine/src/core/merger.ts+++ b/packages/css-engine/src/core/merger.ts@@ -55,6 +55,57 @@ const mergeBox = (styleMap: StyleMap, base: string) => {}};+const mergeWhiteSpaceAndTextWrap = (styleMap: StyleMap) => {+ const collapseValue = styleMap.get("white-space-collapse");+ const collapse = toValue(collapseValue);+ const modeValue = styleMap.get("text-wrap-mode");+ const mode = toValue(modeValue);+ const styleValue = styleMap.get("text-wrap-style");+ const style = toValue(styleValue);+ // completely unsupported anywhere+ styleMap.delete("text-wrap-mode");+ styleMap.delete("text-wrap-style");+ if (+ collapse === "collapse" ||+ collapse === "initial" ||+ mode === "wrap" ||+ mode === "initial"+ ) {+ styleMap.set("white-space", { type: "keyword", value: "normal" });+ }+ if (mode === "nowrap") {+ styleMap.set("white-space", { type: "keyword", value: "nowrap" });+ }+ if (collapse === "preserve") {+ if (mode === "nowrap") {+ styleMap.set("white-space", { type: "keyword", value: "pre" });+ } else {+ styleMap.set("white-space", { type: "keyword", value: "pre-wrap" });+ }+ }+ if (collapse === "preserve-breaks") {+ styleMap.set("white-space", { type: "keyword", value: "pre-line" });+ }+ if (collapse === "break-spaces") {+ styleMap.set("white-space", { type: "keyword", value: "break-spaces" });+ }+ if (style === "balance" || style === "stable" || style === "pretty") {+ styleMap.set("text-wrap", { type: "keyword", value: style });+ }+ // fallback non keyword types as is to text-wrap+ const textWrap =+ (styleValue?.type !== "keyword" ? styleValue : undefined) ??+ (modeValue?.type !== "keyword" ? modeValue : undefined);+ if (textWrap) {+ styleMap.set("text-wrap", textWrap);+ }+ // supported in most browsers so use as fallback in the end+ if (collapseValue) {+ styleMap.delete("white-space-collapse");+ styleMap.set("white-space-collapse", collapseValue);+ }+};+export const mergeStyles = (styleMap: StyleMap) => {const newStyle = new Map(styleMap);mergeBorder(newStyle, "border-top");@@ -66,5 +117,6 @@ export const mergeStyles = (styleMap: StyleMap) => {mergeBox(newStyle, "border");mergeBox(newStyle, "margin");mergeBox(newStyle, "padding");+ mergeWhiteSpaceAndTextWrap(newStyle);return newStyle;};diff --git a/packages/sdk-components-react-radix/src/theme/tailwind-classes.ts b/packages/sdk-components-react-radix/src/theme/tailwind-classes.tsindex 43ffc99031..ce252fd464 100644--- a/packages/sdk-components-react-radix/src/theme/tailwind-classes.ts+++ b/packages/sdk-components-react-radix/src/theme/tailwind-classes.ts@@ -756,10 +756,31 @@ export const font = (export const whitespace = (value: "normal" | "nowrap" | "pre" | "pre-line" | "pre-wrap" | "break-spaces"): EmbedTemplateStyleDecl[] => {+ let whiteSpaceCollapse = "collapse";+ let textWrapMode = "wrap";+ if (value === "normal") {+ [whiteSpaceCollapse, textWrapMode] = ["collapse", "wrap"];+ }+ if (value === "pre") {+ [whiteSpaceCollapse, textWrapMode] = ["preserve", "nowrap"];+ }+ if (value === "pre-wrap") {+ [whiteSpaceCollapse, textWrapMode] = ["preserve", "wrap"];+ }+ if (value === "pre-line") {+ [whiteSpaceCollapse, textWrapMode] = ["preserve-breaks", "wrap"];+ }+ if (value === "break-spaces") {+ [whiteSpaceCollapse, textWrapMode] = ["break-spaces", "wrap"];+ }return [{- property: "whiteSpace",- value: { type: "keyword", value },+ property: "whiteSpaceCollapse",+ value: { type: "keyword", value: whiteSpaceCollapse },+ },+ {+ property: "textWrapMode",+ value: { type: "keyword", value: textWrapMode },},];};diff --git a/packages/sdk-components-react/src/code-text.ws.ts b/packages/sdk-components-react/src/code-text.ws.tsindex a85ac21fe3..61002d110e 100644--- a/packages/sdk-components-react/src/code-text.ws.ts+++ b/packages/sdk-components-react/src/code-text.ws.ts@@ -17,8 +17,12 @@ const presetStyle = {value: { type: "keyword", value: "block" },},{- property: "whiteSpace",- value: { type: "keyword", value: "pre-wrap" },+ property: "whiteSpaceCollapse",+ value: { type: "keyword", value: "preserve" },+ },+ {+ property: "textWrapMode",+ value: { type: "keyword", value: "wrap" },},{property: "paddingLeft",