Skip to content

Commit

Permalink
fix: Lightbox paste partial support (#3744)
Browse files Browse the repository at this point in the history
## 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
  • Loading branch information
istarkov authored Jul 16, 2024
1 parent f3a625f commit 19c95fe
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 5 additions & 1 deletion apps/builder/app/shared/copy-paste/plugin-webflow/schema.ts
Original file line number Diff line number Diff line change
@@ -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();

Expand Down Expand Up @@ -124,6 +126,7 @@ export const wfNodeTypes = [
"NavbarButton",
"NavbarContainer",
"Icon",
"LightboxWrapper",
] as const;

const WfElementNode = z.union([
Expand All @@ -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"]) }),

Expand Down

0 comments on commit 19c95fe

Please sign in to comment.