Skip to content

Commit

Permalink
fix: handle image media in lightbox link
Browse files Browse the repository at this point in the history
  • Loading branch information
surajair committed Nov 26, 2024
1 parent 2a6536d commit 6806995
Showing 1 changed file with 13 additions and 32 deletions.
45 changes: 13 additions & 32 deletions src/web-blocks/lightbox-link.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const LightBoxLinkBlock = (props: ChaiRenderBlockProps<LightBoxLinkProps>) => {
}

const lightBoxAttrs = {};
lightBoxAttrs["data-vbtype"] = hrefType;
if (hrefType !== "image") lightBoxAttrs["data-vbtype"] = hrefType;
if (autoplay) lightBoxAttrs["data-autoplay"] = "true";
if (maxWidth) lightBoxAttrs["data-maxwidth"] = maxWidth + "px";
if (backdropColor) lightBoxAttrs["data-overlay"] = backdropColor;
Expand Down Expand Up @@ -79,46 +79,24 @@ const Config = {
title: "Content",
default: "Link text or drop blocks inside",
},
hrefType: {
type: "string",
title: "Type",
default: "image",
enum: ["image", "video", "iframe", "inline", "ajax"],
enumNames: ["Image", "Video", "Iframe", "Inline", "Ajax"],
},
href: {
type: "string",
title: "Href",
default: "",
},
hrefType: {
type: "string",
title: "Type",
default: "video",
oneOf: [
{
type: "string",
title: "Video",
enum: ["video"],
},
{
type: "string",
title: "Iframe",
enum: ["iframe"],
},
{
type: "string",
title: "Inline",
enum: ["inline"],
},
{
type: "string",
title: "Ajax",
enum: ["ajax"],
},
],
},
autoplay: {
type: "boolean",
title: "Autoplay",
title: "Autoplay (Video only)",
default: false,
dependencies: {
hrefType: ["video"]
}
},

maxWidth: {
type: "number",
title: "Max Width",
Expand All @@ -135,6 +113,9 @@ const Config = {
default: "",
},
},
dependencies: {
autoplay: ["hrefType", "video"],
},
}),
i18nProps: ["content"],
aiProps: ["content"],
Expand Down

0 comments on commit 6806995

Please sign in to comment.