@@ -4,17 +4,24 @@ import { computed, StyleValue } from "vue"
4
4
5
5
const props = defineProps ({ ... defineNotionProps })
6
6
// @ts-ignore
7
- const { type, properties, f } = useNotionBlock (props )
7
+ const { properties, f } = useNotionBlock (props )
8
8
9
9
const 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 ]
11
11
})
12
12
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
+
15
19
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%" ,
17
23
position: " relative" ,
24
+ aspectRatio ,
18
25
} as StyleValue
19
26
})
20
27
</script >
@@ -26,7 +33,7 @@ export default {
26
33
</script >
27
34
28
35
<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" />
31
38
</div >
32
39
</template >
0 commit comments