From 19c95fe9f0895e0e16cd73393de582fc35e72043 Mon Sep 17 00:00:00 2001 From: Ivan Starkov Date: Tue, 16 Jul 2024 21:08:36 +0300 Subject: [PATCH] fix: Lightbox paste partial support (#3744) ## Description Now can be pasted https://www.relume.io/components/gallery-7 ## Steps for reproduction 1. click button 2. expect xyz ## Code Review - [ ] hi @kof, I need you to do - conceptual review (architecture, feature-correctness) - detailed review (read every line) - test it on preview ## Before requesting a review - [ ] made a self-review - [ ] added inline comments where things may be not obvious (the "why", not "what") ## Before merging - [ ] tested locally and on preview environment (preview dev login: 5de6) - [ ] updated [test cases](https://github.com/webstudio-is/webstudio/blob/main/apps/builder/docs/test-cases.md) document - [ ] added tests - [ ] if any new env variables are added, added them to `.env` file --- .../copy-paste/plugin-webflow/instances-properties.ts | 7 ++++++- .../builder/app/shared/copy-paste/plugin-webflow/schema.ts | 6 +++++- 2 files changed, 11 insertions(+), 2 deletions(-) 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.ts index 6138b4afcb24..7b3e1489ff0a 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 @@ -345,7 +345,12 @@ const toFragment = ( addInstance(component); return fragment; } - + case "LightboxWrapper": { + addProp("tag", wfNode.tag); + addProp("href", wfNode.data?.attr?.href); + addInstance("Box", [], component); + return fragment; + } case "NavbarMenu": { addProp("tag", wfNode.tag); addProp("role", wfNode.data?.attr?.role); diff --git a/apps/builder/app/shared/copy-paste/plugin-webflow/schema.ts b/apps/builder/app/shared/copy-paste/plugin-webflow/schema.ts index 2797aacb9e1f..b6b00f8f7e61 100644 --- a/apps/builder/app/shared/copy-paste/plugin-webflow/schema.ts +++ b/apps/builder/app/shared/copy-paste/plugin-webflow/schema.ts @@ -1,6 +1,8 @@ import { z } from "zod"; -const Attr = z.object({ id: z.string(), role: z.string() }).partial(); +const Attr = z + .object({ id: z.string(), role: z.string(), href: z.string() }) + .partial(); const styleBase = z.string(); @@ -124,6 +126,7 @@ export const wfNodeTypes = [ "NavbarButton", "NavbarContainer", "Icon", + "LightboxWrapper", ] as const; const WfElementNode = z.union([ @@ -139,6 +142,7 @@ const WfElementNode = z.union([ }), }), + WfBaseNode.extend({ type: z.enum(["LightboxWrapper"]) }), WfBaseNode.extend({ type: z.enum(["NavbarMenu"]) }), WfBaseNode.extend({ type: z.enum(["NavbarContainer"]) }),