Skip to content

Commit 42df550

Browse files
add quick iframe option for luma embeds (#193)
1 parent 4d03db0 commit 42df550

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

components/Block/Media.vue

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ const { data: block } = useAsyncData(props.uuid, () =>
2929
<BaseMedia
3030
v-if="block"
3131
class="block-media"
32-
:aspect="block.type === 'arcade' ? 'auto' : (block.aspect_ratio ?? undefined)"
32+
:aspect="block.type === 'arcade' || block.type === 'iframe' ? 'auto' : (block.aspect_ratio ?? undefined)"
3333
:border="block.border"
3434
:radius="block.border_radius"
3535
:caption="block.caption ?? undefined"
@@ -65,6 +65,8 @@ const { data: block } = useAsyncData(props.uuid, () =>
6565
/>
6666
</template>
6767

68+
<div v-else-if="block.type === 'iframe' && block.embed" v-html="block.embed" class="iframe" />
69+
6870
<img v-else-if="block.external_image_url" class="media" :src="block.external_image_url" alt="" loading="lazy" />
6971
</BaseMedia>
7072
</template>
@@ -105,4 +107,17 @@ const { data: block } = useAsyncData(props.uuid, () =>
105107
display: none;
106108
}
107109
}
110+
111+
.iframe {
112+
aspect-ratio: 9 / 16;
113+
iframe {
114+
width: 100%;
115+
height: 100%;
116+
}
117+
@container (width > 30rem) {
118+
width: 100%;
119+
aspect-ratio: 16 / 10;
120+
max-height: 450px;
121+
}
122+
}
108123
</style>

types/schema/blocks/block-media.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type { Video } from '../content/video.js';
33

44
export interface BlockMedia {
55
id: string;
6-
type: 'video' | 'image' | 'arcade' | 'external-image' | null;
6+
type: 'video' | 'image' | 'arcade' | 'external-image' | 'iframe' | null;
77
image: string | File | null;
88
video: string | Video | null;
99
embed: string | null;

0 commit comments

Comments
 (0)