@@ -4,17 +4,24 @@ import { computed, StyleValue } from "vue"
44
55const props = defineProps ({ ... defineNotionProps })
66// @ts-ignore
7- const { type, properties, f } = useNotionBlock (props )
7+ const { properties, f } = useNotionBlock (props )
88
99const src = computed (() => {
10- return type .value === " figma " ? properties .value ?.source [0 ][ 0 ] : f . value . display_source
10+ return f .value . display_source ?? properties .value ?.source ?. [0 ]
1111})
1212
13- const style = computed (() => {
14- const aspectRatio = f .value .block_aspect_ratio || f .value .block_height / f .value .block_width
13+ const aspectRatioStyle = computed (() => {
14+ let aspectRatio =
15+ f .value .block_width == 1 || f .value .block_height == 1
16+ ? 1 / f .value .block_aspect_ratio
17+ : ` ${f .value .block_width } / ${f .value .block_height } `
18+
1519 return {
16- paddingBottom: ` ${aspectRatio * 100 }% ` ,
20+ width: f .value .block_width == 1 ? " 100%" : ` ${f .value .block_width }px ` ,
21+ height: f .value .block_height == 1 ? ` 100% ` : ` ${f .value .block_height }px ` ,
22+ maxWidth: " 100%" ,
1723 position: " relative" ,
24+ aspectRatio ,
1825 } as StyleValue
1926})
2027 </script >
@@ -26,7 +33,7 @@ export default {
2633 </script >
2734
2835<template >
29- <div :style =" style " v-if =" src" >
30- <iframe class = " notion-image-inset " style =" width : 100% " :src =" src" :allow =" props.embedAllow" />
36+ <div :style =" aspectRatioStyle " v-if =" src" >
37+ <iframe style =" width : 100 % ; height : 100% " :src =" src" :allow =" props.embedAllow" />
3138 </div >
3239</template >
0 commit comments