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
refactor: paste new tag with webflow and markdown (#5092)
Bogdan Chadkin31212266c712
diff --git a/apps/builder/app/shared/content-model.test.tsx b/apps/builder/app/shared/content-model.test.tsxindex 7e1aadfcd0..66f81dbd01 100644--- a/apps/builder/app/shared/content-model.test.tsx+++ b/apps/builder/app/shared/content-model.test.tsx@@ -8,42 +8,46 @@ const defaultMetas = new Map(Object.entries({ ...coreMetas, ...baseComponentMetas }));-test("flow accepts flow", () => {+test("support element with ws:tag", () => {expect(isTreeSatisfyingContentModel({...renderData(- <$.Body ws:id="bodyId">- <$.Box ws:id="articleId" tag="article"></$.Box>- </$.Body>+ <ws.element ws:tag="body" ws:id="bodyId">+ <ws.element ws:tag="span">+ <ws.element ws:tag="article"></ws.element>+ </ws.element>+ </ws.element>),metas: defaultMetas,instanceSelector: ["bodyId"],})- ).toBeTruthy();+ ).toBeFalsy();});-test("none category accepted by parent by tag", () => {+test("support Box with ws:tag", () => {expect(isTreeSatisfyingContentModel({...renderData(<$.Body ws:id="bodyId">- <$.List ws:id="listId">- <$.ListItem ws:id="itemId"></$.ListItem>- </$.List>+ <$.Box ws:tag="span">+ <$.Box ws:tag="article"></$.Box>+ </$.Box></$.Body>),metas: defaultMetas,- instanceSelector: ["listId"],+ instanceSelector: ["bodyId"],})- ).toBeTruthy();+ ).toBeFalsy();});-test("none category prevents unacceptable parent 1", () => {+test("support legacy tag property", () => {expect(isTreeSatisfyingContentModel({...renderData(<$.Body ws:id="bodyId">- <$.ListItem ws:id="itemId"></$.ListItem>+ <$.Box tag="span">+ <$.Box tag="article"></$.Box>+ </$.Box></$.Body>),metas: defaultMetas,@@ -52,17 +56,58 @@ test("none category prevents unacceptable parent 1", () => {).toBeFalsy();});-test("none category prevents unacceptable parent 2", () => {+test("flow accepts flow", () => {expect(isTreeSatisfyingContentModel({...renderData(- <$.Body ws:id="bodyId">- <$.List ws:id="listId">- <$.Box ws:id="divId">- <$.ListItem ws:id="itemId"></$.ListItem>- </$.Box>- </$.List>- </$.Body>+ <ws.element ws:tag="body" ws:id="bodyId">+ <ws.element ws:tag="article"></ws.element>+ </ws.element>+ ),+ metas: defaultMetas,+ instanceSelector: ["bodyId"],+ })+ ).toBeTruthy();+});++test("none category accepted by parent by tag", () => {+ expect(+ isTreeSatisfyingContentModel({+ ...renderData(+ <ws.element ws:tag="body" ws:id="bodyId">+ <ws.element ws:tag="ul">+ <ws.element ws:tag="li"></ws.element>+ </ws.element>+ </ws.element>+ ),+ metas: defaultMetas,+ instanceSelector: ["bodyId"],+ })+ ).toBeTruthy();+});++test("none category prevents unacceptable parent", () => {+ expect(+ isTreeSatisfyingContentModel({+ ...renderData(+ <ws.element ws:tag="body" ws:id="bodyId">+ <ws.element ws:tag="li"></ws.element>+ </ws.element>+ ),+ metas: defaultMetas,+ instanceSelector: ["bodyId"],+ })+ ).toBeFalsy();+ expect(+ isTreeSatisfyingContentModel({+ ...renderData(+ <ws.element ws:tag="body" ws:id="bodyId">+ <ws.element ws:tag="ul">+ <ws.element ws:tag="div">+ <ws.element ws:tag="li"></ws.element>+ </ws.element>+ </ws.element>+ </ws.element>),metas: defaultMetas,instanceSelector: ["bodyId"],@@ -74,15 +119,15 @@ test("slot without tag accepts transparent category", () => {expect(isTreeSatisfyingContentModel({...renderData(- <$.Body ws:id="bodyId">- <$.List ws:id="listId">- <$.Slot ws:id="slotId">- <$.Fragment ws:id="fragmentId">- <$.ListItem ws:id="itemId"></$.ListItem>+ <ws.element ws:tag="body" ws:id="bodyId">+ <ws.element ws:tag="ul">+ <$.Slot>+ <$.Fragment>+ <ws.element ws:tag="li"></ws.element></$.Fragment></$.Slot>- </$.List>- </$.Body>+ </ws.element>+ </ws.element>),metas: defaultMetas,instanceSelector: ["bodyId"],@@ -94,13 +139,13 @@ test("collection without tag accepts transparent category", () => {expect(isTreeSatisfyingContentModel({...renderData(- <$.Body ws:id="bodyId">- <$.List ws:id="listId">- <ws.collection ws:id="collectionId">- <$.ListItem ws:id="itemId"></$.ListItem>+ <ws.element ws:tag="body" ws:id="bodyId">+ <ws.element ws:tag="ul">+ <ws.collection>+ <ws.element ws:tag="li"></ws.element></ws.collection>- </$.List>- </$.Body>+ </ws.element>+ </ws.element>),metas: defaultMetas,instanceSelector: ["bodyId"],@@ -112,11 +157,11 @@ test("transparent category accepts flow", () => {expect(isTreeSatisfyingContentModel({...renderData(- <$.Body ws:id="bodyId">- <$.Link ws:id="linkId">- <$.Box ws:id="articleId" tag="article"></$.Box>- </$.Link>- </$.Body>+ <ws.element ws:tag="body" ws:id="bodyId">+ <ws.element ws:tag="a">+ <ws.element ws:tag="article"></ws.element>+ </ws.element>+ </ws.element>),metas: defaultMetas,instanceSelector: ["bodyId"],@@ -128,11 +173,11 @@ test("phrasing category accepts element with transparent children", () => {expect(isTreeSatisfyingContentModel({...renderData(- <$.Body ws:id="bodyId">- <$.Box ws:id="spanId" tag="span">- <$.Link ws:id="linkId"></$.Link>- </$.Box>- </$.Body>+ <ws.element ws:tag="body" ws:id="bodyId">+ <ws.element ws:tag="span">+ <ws.element ws:tag="a"></ws.element>+ </ws.element>+ </ws.element>),metas: defaultMetas,instanceSelector: ["bodyId"],@@ -144,13 +189,13 @@ test("transparent category should pass through phrasing category and forbid flowexpect(isTreeSatisfyingContentModel({...renderData(- <$.Body ws:id="bodyId">- <$.Box ws:id="spanId" tag="span">- <$.Link ws:id="linkId">- <$.Box ws:id="anotherSpanId" tag="span"></$.Box>- </$.Link>- </$.Box>- </$.Body>+ <ws.element ws:tag="body" ws:id="bodyId">+ <ws.element ws:tag="span">+ <ws.element ws:tag="a">+ <ws.element ws:tag="span"></ws.element>+ </ws.element>+ </ws.element>+ </ws.element>),metas: defaultMetas,instanceSelector: ["bodyId"],@@ -159,13 +204,13 @@ test("transparent category should pass through phrasing category and forbid flowexpect(isTreeSatisfyingContentModel({...renderData(- <$.Body ws:id="bodyId">- <$.Box ws:id="spanId" tag="span">- <$.Link ws:id="linkId">- <$.Box ws:id="articleId" tag="article"></$.Box>- </$.Link>- </$.Box>- </$.Body>+ <ws.element ws:tag="body" ws:id="bodyId">+ <ws.element ws:tag="span">+ <ws.element ws:tag="a">+ <ws.element ws:tag="article"></ws.element>+ </ws.element>+ </ws.element>+ </ws.element>),metas: defaultMetas,instanceSelector: ["bodyId"],@@ -177,13 +222,13 @@ test("transparent category should not pass through invalid parent", () => {expect(isTreeSatisfyingContentModel({...renderData(- <$.Body ws:id="bodyId">- <$.List ws:id="listId">- <$.Link ws:id="linkId">- <$.ListItem ws:id="itemId"></$.ListItem>- </$.Link>- </$.List>- </$.Body>+ <ws.element ws:tag="body" ws:id="bodyId">+ <ws.element ws:tag="ul">+ <ws.element ws:tag="a">+ <ws.element ws:tag="li"></ws.element>+ </ws.element>+ </ws.element>+ </ws.element>),metas: defaultMetas,instanceSelector: ["bodyId"],@@ -195,13 +240,13 @@ test("transparent category should pass through category when check deep in the texpect(isTreeSatisfyingContentModel({...renderData(- <$.Body ws:id="bodyId">- <$.Box ws:id="spanId" tag="span">- <$.Link ws:id="linkId">- <$.Bold ws:id="boldId"></$.Bold>- </$.Link>- </$.Box>- </$.Body>+ <ws.element ws:tag="body" ws:id="bodyId">+ <ws.element ws:tag="span" ws:id="spanId">+ <ws.element ws:tag="a" ws:id="linkId">+ <ws.element ws:tag="strong"></ws.element>+ </ws.element>+ </ws.element>+ </ws.element>),metas: defaultMetas,instanceSelector: ["linkId", "spanId", "bodyId"],@@ -210,13 +255,13 @@ test("transparent category should pass through category when check deep in the texpect(isTreeSatisfyingContentModel({...renderData(- <$.Body ws:id="bodyId">- <$.Box ws:id="spanId" tag="span">- <$.Link ws:id="linkId">- <$.Box ws:id="articleId" tag="article"></$.Box>- </$.Link>- </$.Box>- </$.Body>+ <ws.element ws:tag="body" ws:id="bodyId">+ <ws.element ws:tag="span" ws:id="spanId">+ <ws.element ws:tag="a" ws:id="linkId">+ <ws.element ws:tag="article"></ws.element>+ </ws.element>+ </ws.element>+ </ws.element>),metas: defaultMetas,instanceSelector: ["linkId", "spanId", "bodyId"],@@ -228,9 +273,9 @@ test("restrict empty category", () => {expect(isTreeSatisfyingContentModel({...renderData(- <$.Body ws:id="bodyId">- <$.Separator ws:id="separatorId" />- </$.Body>+ <ws.element ws:tag="body" ws:id="bodyId">+ <ws.element ws:tag="hr"></ws.element>+ </ws.element>),metas: defaultMetas,instanceSelector: ["bodyId"],@@ -239,11 +284,11 @@ test("restrict empty category", () => {expect(isTreeSatisfyingContentModel({...renderData(- <$.Body ws:id="bodyId">- <$.Separator ws:id="separatorId">- <$.Box ws:id="spanId" tag="span"></$.Box>- </$.Separator>- </$.Body>+ <ws.element ws:tag="body" ws:id="bodyId">+ <ws.element ws:tag="hr">+ <ws.element ws:tag="span"></ws.element>+ </ws.element>+ </ws.element>),metas: defaultMetas,instanceSelector: ["bodyId"],@@ -255,11 +300,11 @@ test("prevent nesting interactive instances", () => {expect(isTreeSatisfyingContentModel({...renderData(- <$.Body ws:id="bodyId">- <$.Button>- <$.Button></$.Button>- </$.Button>- </$.Body>+ <ws.element ws:tag="body" ws:id="bodyId">+ <ws.element ws:tag="button">+ <ws.element ws:tag="button"></ws.element>+ </ws.element>+ </ws.element>),metas: defaultMetas,instanceSelector: ["bodyId"],@@ -268,13 +313,13 @@ test("prevent nesting interactive instances", () => {expect(isTreeSatisfyingContentModel({...renderData(- <$.Body ws:id="bodyId">- <$.Button>- <$.Box tag="span">- <$.Link></$.Link>- </$.Box>- </$.Button>- </$.Body>+ <ws.element ws:tag="body" ws:id="bodyId">+ <ws.element ws:tag="button">+ <ws.element ws:tag="span">+ <ws.element ws:tag="a"></ws.element>+ </ws.element>+ </ws.element>+ </ws.element>),metas: defaultMetas,instanceSelector: ["bodyId"],@@ -286,15 +331,15 @@ test("prevent nesting interactive instances with slots in between", () => {expect(isTreeSatisfyingContentModel({...renderData(- <$.Body ws:id="bodyId">- <$.Button>+ <ws.element ws:tag="body" ws:id="bodyId">+ <ws.element ws:tag="button"><$.Slot><$.Fragment>- <$.Textarea></$.Textarea>+ <ws.element ws:tag="textarea"></ws.element></$.Fragment></$.Slot>- </$.Button>- </$.Body>+ </ws.element>+ </ws.element>),metas: defaultMetas,instanceSelector: ["bodyId"],@@ -306,13 +351,13 @@ test("prevent nesting interactive instances when check deep in the tree", () =>expect(isTreeSatisfyingContentModel({...renderData(- <$.Body ws:id="bodyId">- <$.Button ws:id="buttonId">- <$.Box ws:id="spanId" tag="span">- <$.Link ws:id="linkId"></$.Link>- </$.Box>- </$.Button>- </$.Body>+ <ws.element ws:tag="body" ws:id="bodyId">+ <ws.element ws:tag="button" ws:id="buttonId">+ <ws.element ws:tag="span" ws:id="spanId">+ <ws.element ws:tag="a" ws:id="linkId"></ws.element>+ </ws.element>+ </ws.element>+ </ws.element>),metas: defaultMetas,instanceSelector: ["linkId", "spanId", "buttonId", "bodyId"],@@ -324,11 +369,11 @@ test("prevent nesting forms", () => {expect(isTreeSatisfyingContentModel({...renderData(- <$.Body ws:id="bodyId">- <$.Form>- <$.Button></$.Button>- </$.Form>- </$.Body>+ <ws.element ws:tag="body" ws:id="bodyId">+ <ws.element ws:tag="form">+ <ws.element ws:tag="button"></ws.element>+ </ws.element>+ </ws.element>),metas: defaultMetas,instanceSelector: ["bodyId"],@@ -337,15 +382,15 @@ test("prevent nesting forms", () => {expect(isTreeSatisfyingContentModel({...renderData(- <$.Body ws:id="bodyId">- <$.Form ws:id="formId">- <$.Box ws:id="divId">- <$.Form ws:id="anotherFormId">- <$.Button ws:id="buttonId"></$.Button>- </$.Form>- </$.Box>- </$.Form>- </$.Body>+ <ws.element ws:tag="body" ws:id="bodyId">+ <ws.element ws:tag="form" ws:id="formId">+ <ws.element ws:tag="div" ws:id="divId">+ <ws.element ws:tag="form" ws:id="anotherFormId">+ <ws.element ws:tag="button"></ws.element>+ </ws.element>+ </ws.element>+ </ws.element>+ </ws.element>),metas: defaultMetas,instanceSelector: ["anotherFormId", "divId", "formId", "bodyId"],@@ -357,18 +402,18 @@ test("allow wrapping labelable controls with label", () => {expect(isTreeSatisfyingContentModel({...renderData(- <$.Body ws:id="bodyId">- <$.Label>- <$.Box tag="span">- <$.Input />- </$.Box>- </$.Label>- <$.Label>- <$.Box tag="span">- <$.Button />- </$.Box>- </$.Label>- </$.Body>+ <ws.element ws:tag="body" ws:id="bodyId">+ <ws.element ws:tag="label">+ <ws.element ws:tag="span">+ <ws.element ws:tag="input"></ws.element>+ </ws.element>+ </ws.element>+ <ws.element ws:tag="label">+ <ws.element ws:tag="span">+ <ws.element ws:tag="button"></ws.element>+ </ws.element>+ </ws.element>+ </ws.element>),metas: defaultMetas,instanceSelector: ["bodyId"],@@ -377,13 +422,13 @@ test("allow wrapping labelable controls with label", () => {expect(isTreeSatisfyingContentModel({...renderData(- <$.Body ws:id="bodyId">- <$.Label>- <$.Box tag="span">- <$.Link />- </$.Box>- </$.Label>- </$.Body>+ <ws.element ws:tag="body" ws:id="bodyId">+ <ws.element ws:tag="label">+ <ws.element ws:tag="span">+ <ws.element ws:tag="a"></ws.element>+ </ws.element>+ </ws.element>+ </ws.element>),metas: defaultMetas,instanceSelector: ["bodyId"],@@ -392,13 +437,13 @@ test("allow wrapping labelable controls with label", () => {expect(isTreeSatisfyingContentModel({...renderData(- <$.Body ws:id="bodyId">- <$.Label>- <$.Button>- <$.Input />- </$.Button>- </$.Label>- </$.Body>+ <ws.element ws:tag="body" ws:id="bodyId">+ <ws.element ws:tag="label">+ <ws.element ws:tag="button">+ <ws.element ws:tag="input"></ws.element>+ </ws.element>+ </ws.element>+ </ws.element>),metas: defaultMetas,instanceSelector: ["bodyId"],@@ -410,11 +455,11 @@ test("edge case: allow inserting div where phrasing is required", () => {expect(isTreeSatisfyingContentModel({...renderData(- <$.Body ws:id="bodyId">- <$.Button>- <$.Box></$.Box>- </$.Button>- </$.Body>+ <ws.element ws:tag="body" ws:id="bodyId">+ <ws.element ws:tag="button">+ <ws.element ws:tag="div"></ws.element>+ </ws.element>+ </ws.element>),metas: defaultMetas,instanceSelector: ["bodyId"],@@ -426,11 +471,11 @@ test("edge case: support a > img", () => {expect(isTreeSatisfyingContentModel({...renderData(- <$.Body ws:id="bodyId">- <$.Link>- <$.Image />- </$.Link>- </$.Body>+ <ws.element ws:tag="body" ws:id="bodyId">+ <ws.element ws:tag="a">+ <ws.element ws:tag="img"></ws.element>+ </ws.element>+ </ws.element>),metas: defaultMetas,instanceSelector: ["bodyId"],diff --git a/apps/builder/app/shared/content-model.ts b/apps/builder/app/shared/content-model.tsindex b519449ac5..0480af3332 100644--- a/apps/builder/app/shared/content-model.ts+++ b/apps/builder/app/shared/content-model.ts@@ -35,10 +35,9 @@ const getTag = ({metas: Map<Instance["component"], WsComponentMeta>;props: Props;}) => {- const tagByInstanceId = getTagByInstanceId(props);const meta = metas.get(instance.component);const metaTag = Object.keys(meta?.presetStyle ?? {}).at(0);- return tagByInstanceId.get(instance.id) ?? metaTag;+ return instance.tag ?? getTagByInstanceId(props).get(instance.id) ?? metaTag;};const isIntersected = (arrayA: string[], arrayB: string[]) => {diff --git a/apps/builder/app/shared/copy-paste/plugin-markdown.test.ts b/apps/builder/app/shared/copy-paste/plugin-markdown.test.tsindex 8fdc758ebf..8ac9b01e8b 100644--- a/apps/builder/app/shared/copy-paste/plugin-markdown.test.ts+++ b/apps/builder/app/shared/copy-paste/plugin-markdown.test.ts@@ -65,18 +65,11 @@ describe("Plugin Markdown", () => {],"component": "Heading","id": "123",+ "tag": "h1","type": "instance",},],- "props": [- {- "id": "123",- "instanceId": "123",- "name": "tag",- "type": "string",- "value": "h1",- },- ],+ "props": [],"resources": [],"styleSourceSelections": [],"styleSources": [],@@ -107,18 +100,11 @@ describe("Plugin Markdown", () => {],"component": "Heading","id": "123",+ "tag": "h6","type": "instance",},],- "props": [- {- "id": "123",- "instanceId": "123",- "name": "tag",- "type": "string",- "value": "h6",- },- ],+ "props": [],"resources": [],"styleSourceSelections": [],"styleSources": [],diff --git a/apps/builder/app/shared/copy-paste/plugin-markdown.ts b/apps/builder/app/shared/copy-paste/plugin-markdown.tsindex 3a53f8fbec..2c43a233a6 100644--- a/apps/builder/app/shared/copy-paste/plugin-markdown.ts+++ b/apps/builder/app/shared/copy-paste/plugin-markdown.ts@@ -80,13 +80,7 @@ const toInstanceData = (children.push({ type: "id", value: instanceId });if (child.type === "heading") {- props.push({- id: generateId(),- type: "string",- name: "tag",- instanceId,- value: `h${child.depth}`,- });+ instance.tag = `h${child.depth}`;}if (child.type === "link") {props.push({diff --git a/apps/builder/app/shared/copy-paste/plugin-webflow/instances-properties.ts b/apps/builder/app/shared/copy-paste/plugin-webflow/instances-properties.tsindex 27ad7dac32..6bf97bba9d 100644--- a/apps/builder/app/shared/copy-paste/plugin-webflow/instances-properties.ts+++ b/apps/builder/app/shared/copy-paste/plugin-webflow/instances-properties.ts@@ -58,17 +58,20 @@ const toFragment = (}};- const addInstance = (- component: Instance["component"],- children: Instance["children"] = [],- label?: string- ) => {+ const addInstance = ({+ children = [],+ ...instance+ }: {+ component: Instance["component"];+ tag?: string;+ children?: Instance["children"];+ label?: string;+ }) => {fragment.instances.push({id: instanceId,type: "instance",- component,children,- ...(label ? { label } : undefined),+ ...instance,});};@@ -88,15 +91,14 @@ const toFragment = (return fragment;}case "Heading": {- addProp("tag", wfNode.tag);- addInstance(component);+ addInstance({ component, tag: wfNode.tag });return fragment;}case "List": {if (wfNode.tag === "ol") {addProp("ordered", true);}- addInstance(component);+ addInstance({ component });return fragment;}case "ListItem":@@ -105,15 +107,12 @@ const toFragment = (case "Subscript":case "Blockquote":case "Span": {- addInstance(component);+ addInstance({ component });return fragment;}case "Block": {const component = wfNode.data?.text ? "Text" : "Box";- if (wfNode.tag !== "div") {- addProp("tag", wfNode.tag);- }- addInstance(component);+ addInstance({ component, tag: wfNode.tag });return fragment;}@@ -139,69 +138,68 @@ const toFragment = (if ("tel" in data.link) {addProp("href", `tel:${data.link.tel}`);}- addInstance(component);+ addInstance({ component });return fragment;}case "Section": {const component = "Box";- addProp("tag", wfNode.tag);- addInstance(component);+ addInstance({ component, tag: wfNode.tag });return fragment;}case "RichText": {const component = "Box";- addInstance(component);+ addInstance({ component });return fragment;}case "Strong": {const component = "Bold";- addInstance(component);+ addInstance({ component });return fragment;}case "Emphasized": {const component = "Italic";- addInstance(component);+ addInstance({ component });return fragment;}case "Container":case "BlockContainer": {const component = "Box";- addInstance(component);+ addInstance({ component });return fragment;}case "Layout": {const component = "Box";- addInstance(component);+ addInstance({ component });return fragment;}case "Cell": {const component = "Box";- addInstance(component);+ addInstance({ component });return fragment;}case "VFlex": {const component = "Box";- addInstance(component);+ addInstance({ component });return fragment;}case "HFlex": {const component = "Box";- addInstance(component);+ addInstance({ component });return fragment;}case "Grid": {const component = "Box";- addInstance(component);+ addInstance({ component });return fragment;}case "Row": {const component = "Box";- addInstance(component);+ addInstance({ component });return fragment;}case "Column": {const component = "Box";- addInstance(component);+ addInstance({ component });return fragment;}case "CodeBlock": {@@ -209,13 +207,13 @@ const toFragment = (const data = wfNode.data;addProp("lang", data.language);addProp("code", data.code);- addInstance(component);+ addInstance({ component });return fragment;}case "HtmlEmbed": {addProp("code", wfNode.v);addProp("clientOnly", true);- addInstance(component);+ addInstance({ component });return fragment;}case "Image": {@@ -245,17 +243,17 @@ const toFragment = (if (data.attr.src) {addProp("src", data.attr.src);}- addInstance(component);+ addInstance({ component });return fragment;}case "FormWrapper": {const component = "Box";- addInstance(component);+ addInstance({ component });return fragment;}case "FormForm": {const component = "Box";- addInstance(component);+ addInstance({ component });return fragment;}case "FormErrorMessage":@@ -265,12 +263,15 @@ const toFragment = (case "FormButton": {const component = "Button";const data = wfNode.data;- addInstance(component, [- {- type: "text" as const,- value: data.attr.value,- },- ]);+ addInstance({+ component,+ children: [+ {+ type: "text" as const,+ value: data.attr.value,+ },+ ],+ });return fragment;}case "FormTextInput": {@@ -283,7 +284,7 @@ const toFragment = (addProp("type", data.attr.type);addProp("required", data.attr.required);addProp("autoFocus", data.attr.autofocus);- addInstance(component);+ addInstance({ component });return fragment;}case "FormTextarea": {@@ -294,19 +295,19 @@ const toFragment = (addProp("placeholder", data.attr.placeholder);addProp("required", data.attr.required);addProp("autoFocus", data.attr.autofocus);- addInstance(component);+ addInstance({ component });return fragment;}case "FormBlockLabel": {const data = wfNode.data;const component = "Label";addProp("htmlFor", data.attr.for);- addInstance(component);+ addInstance({ component });return fragment;}case "FormCheckboxWrapper": {const component = "Label";- addInstance(component, [], "Checkbox Field");+ addInstance({ component, label: "Checkbox Field" });return fragment;}case "FormCheckboxInput": {@@ -315,18 +316,17 @@ const toFragment = (addProp("name", data.attr.name);addProp("required", data.attr.required);addProp("defaultChecked", data.attr.checked);- addInstance(component);+ addInstance({ component });return fragment;}case "FormInlineLabel": {const component = "Text";- addProp("tag", "span");- addInstance(component, [], "Label");+ addInstance({ component, tag: "span", label: "Label" });return fragment;}case "FormRadioWrapper": {const component = "Label";- addInstance(component, [], "Radio Field");+ addInstance({ component, label: "Radio Field" });return fragment;}case "FormRadioInput": {@@ -335,7 +335,7 @@ const toFragment = (addProp("name", data.attr.name);addProp("required", data.attr.required);addProp("value", data.attr.value);- addInstance(component);+ addInstance({ component });return fragment;}case "FormSelect": {@@ -345,26 +345,23 @@ const toFragment = (addProp("name", data.attr.name);addProp("required", data.attr.required);addProp("multiple", data.attr.multiple);- addInstance(component);+ addInstance({ component });return fragment;}case "LightboxWrapper": {- addProp("tag", wfNode.tag);addProp("href", wfNode.data?.attr?.href);- addInstance("Box", [], component);+ addInstance({ component: "Box", tag: wfNode.tag, label: component });return fragment;}case "NavbarMenu": {- addProp("tag", wfNode.tag);addProp("role", wfNode.data?.attr?.role);-- addInstance("Box", [], component);+ addInstance({ component: "Box", tag: wfNode.tag, label: component });return fragment;}case "NavbarContainer":case "NavbarButton":case "NavbarWrapper": {- addInstance("Box", [], component);+ addInstance({ component: "Box", label: component });return fragment;}@@ -389,18 +386,18 @@ const toFragment = (if ("tel" in data.link) {addProp("href", `tel:${data.link.tel}`);}- addInstance("Link", [], component);+ addInstance({ component: "Link", label: component });return fragment;}case "Icon": {// We don't have access to widget icons- addInstance("Box", [], component);+ addInstance({ component: "Box", label: component });return fragment;}+ default:+ (component) satisfies never;}-- (component) satisfies never;};const addCustomAttributes = (diff --git a/apps/builder/app/shared/copy-paste/plugin-webflow/plugin-webflow.test.tsx b/apps/builder/app/shared/copy-paste/plugin-webflow/plugin-webflow.test.tsxindex c830c3e951..e62d7a6f9a 100644--- a/apps/builder/app/shared/copy-paste/plugin-webflow/plugin-webflow.test.tsx+++ b/apps/builder/app/shared/copy-paste/plugin-webflow/plugin-webflow.test.tsx@@ -140,7 +140,7 @@ test("Heading", async () => {},});- equalFragment(fragment, <$.Heading tag="h1">Turtle in the sea</$.Heading>);+ equalFragment(fragment, <$.Heading ws:tag="h1">Turtle in the sea</$.Heading>);expect(toCss(fragment)).toMatchInlineSnapshot(`"@media all {h1 {@@ -325,7 +325,7 @@ test("Text", async () => {equalFragment(fragment,- <$.Text>This is some text inside of a div block.</$.Text>+ <$.Text ws:tag="div">This is some text inside of a div block.</$.Text>);expect(toCss(fragment)).toMatchInlineSnapshot(`""`);@@ -525,7 +525,7 @@ test("Section", async () => {},});- equalFragment(fragment, <$.Box tag="section" />);+ equalFragment(fragment, <$.Box ws:tag="section" />);expect(toCss(fragment)).toMatchInlineSnapshot(`"@media all {section {@@ -553,7 +553,7 @@ test("Figure", async () => {},});- equalFragment(fragment, <$.Box tag="figure" />);+ equalFragment(fragment, <$.Box ws:tag="figure" />);expect(toCss(fragment)).toMatchInlineSnapshot(`"@media all {figure {@@ -655,7 +655,7 @@ test("Block", async () => {},});- equalFragment(fragment, <$.Box />);+ equalFragment(fragment, <$.Box ws:tag="div" />);expect(toCss(fragment)).toMatchInlineSnapshot(`""`);});@@ -1403,12 +1403,12 @@ test("RichText", async () => {equalFragment(fragment,<$.Box>- <$.Heading tag="h1">Heading 1</$.Heading>- <$.Heading tag="h2">Heading 2</$.Heading>- <$.Heading tag="h3">Heading 3</$.Heading>- <$.Heading tag="h4">Heading 4</$.Heading>- <$.Heading tag="h5">Heading 5</$.Heading>- <$.Heading tag="h6">Heading 6</$.Heading>+ <$.Heading ws:tag="h1">Heading 1</$.Heading>+ <$.Heading ws:tag="h2">Heading 2</$.Heading>+ <$.Heading ws:tag="h3">Heading 3</$.Heading>+ <$.Heading ws:tag="h4">Heading 4</$.Heading>+ <$.Heading ws:tag="h5">Heading 5</$.Heading>+ <$.Heading ws:tag="h6">Heading 6</$.Heading><$.Paragraph>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmodtempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim@@ -2124,7 +2124,7 @@ test("FormCheckboxWrapper, FormCheckboxInput, FormInlineLabel", async () => {required={false}defaultChecked={false}/>- <$.Text tag="span" ws:label="Label">+ <$.Text ws:tag="span" ws:label="Label">Checkbox</$.Text></$.Label>@@ -2249,7 +2249,7 @@ test("FormRadioWrapper, FormRadioInput, FormInlineLabel", async () => {fragment,<$.Label ws:label="Radio Field"><$.RadioButton id="radio" name="radio" required={false} value="Radio" />- <$.Text tag="span" ws:label="Label">+ <$.Text ws:tag="span" ws:label="Label">Radio</$.Text></$.Label>@@ -2430,7 +2430,7 @@ test("Multiline text", async () => {equalFragment(fragment,- <$.Box>+ <$.Box ws:tag="div">{"a"}{"\n"}{"b"}@@ -2466,7 +2466,7 @@ describe("Custom attributes", () => {assets: [],},});- equalFragment(fragment, <$.Heading tag="h1" at="b" />);+ equalFragment(fragment, <$.Heading ws:tag="h1" at="b" />);expect(toCss(fragment)).toMatchInlineSnapshot(`"@media all {h1 {@@ -2505,7 +2505,7 @@ test("Set show false when visibility's only condition is false", async () => {assets: [],},});- equalFragment(fragment, <$.Box data-ws-show={false} />);+ equalFragment(fragment, <$.Box data-ws-show={false} ws:tag="div" />);expect(toCss(fragment)).toMatchInlineSnapshot(`""`);});diff --git a/apps/builder/app/shared/instance-utils.test.tsx b/apps/builder/app/shared/instance-utils.test.tsxindex 1c80e03fd0..b4f1b0e6d2 100644--- a/apps/builder/app/shared/instance-utils.test.tsx+++ b/apps/builder/app/shared/instance-utils.test.tsx@@ -1466,14 +1466,14 @@ describe("find closest insertable", () => {const { instances } = renderData(<$.Body ws:id="bodyId"><$.Paragraph ws:id="paragraphId">- <$.Box ws:id="spanId" tag="span"></$.Box>+ <$.Box ws:id="spanId" ws:tag="span"></$.Box></$.Paragraph></$.Body>);$instances.set(instances);selectInstance(["boxId", "paragraphId", "bodyId"]);expect(- findClosestInsertable(renderTemplate(<$.Box tag="span"></$.Box>))+ findClosestInsertable(renderTemplate(<$.Box ws:tag="span"></$.Box>))).toEqual({parentSelector: ["paragraphId", "bodyId"],position: 0,