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: ignore content model checks for XmlNode component (#5268)

Bogdan Chadkindf9fecff3b73
diff --git a/apps/builder/app/shared/content-model.test.tsx b/apps/builder/app/shared/content-model.test.tsx
index 3bbc20b513..8f6ec62bce 100644
--- a/apps/builder/app/shared/content-model.test.tsx
+++ b/apps/builder/app/shared/content-model.test.tsx
@@ -505,6 +505,22 @@ test("support video > source", () => {
).toBeTruthy();
});
+test("support xml node with tags", () => {
+ expect(
+ isTreeSatisfyingContentModel({
+ ...renderData(
+ <ws.element ws:tag="body" ws:id="bodyId">
+ <$.XmlNode tag="url">
+ <$.XmlNode tag="loc"></$.XmlNode>
+ </$.XmlNode>
+ </ws.element>
+ ),
+ metas: defaultMetas,
+ instanceSelector: ["bodyId"],
+ })
+ ).toBeTruthy();
+});
+
describe("component content model", () => {
test("restrict children with specific component", () => {
expect(
diff --git a/apps/builder/app/shared/content-model.ts b/apps/builder/app/shared/content-model.ts
index aa7260cb93..2f0b40195e 100644
--- a/apps/builder/app/shared/content-model.ts
+++ b/apps/builder/app/shared/content-model.ts
@@ -37,6 +37,10 @@ const getTag = ({
metas: Metas;
props: Props;
}) => {
+ // ignore tag property on xml nodes
+ if (instance.component === "XmlNode") {
+ return;
+ }
const meta = metas.get(instance.component);
const metaTag = Object.keys(meta?.presetStyle ?? {}).at(0);
return instance.tag ?? getTagByInstanceId(props).get(instance.id) ?? metaTag;