Skip to content

Commit e0b4631

Browse files
committed
fix page width
1 parent 389b8af commit e0b4631

File tree

4 files changed

+14
-12
lines changed

4 files changed

+14
-12
lines changed

src/blocks/helpers/asset.vue

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { computed, StyleValue } from "vue"
44
55
const props = defineProps({ ...defineNotionProps })
66
//@ts-ignore
7-
const { properties, f } = useNotionBlock(props)
7+
const { properties, f, format } = useNotionBlock(props)
88
99
const src = computed(() => {
1010
return f.value.display_source ?? properties.value?.source?.[0]
@@ -17,11 +17,15 @@ const aspectRatioStyle = computed(() => {
1717
: `${f.value.block_width} / ${f.value.block_height} `
1818
1919
return {
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`,
20+
width: format.value.block_full_width
21+
? "calc(100vw - 46px)"
22+
: format.value.block_page_width
23+
? "100%"
24+
: `${f.value.block_width}px`,
25+
height: f.value.block_height == 1 ? `auto` : `${f.value.block_height}px`,
2226
maxWidth: "100%",
2327
position: "relative",
24-
aspectRatio,
28+
aspectRatio: f.value.block_height == 1 ? aspectRatio : undefined,
2529
} as StyleValue
2630
})
2731
</script>
@@ -34,6 +38,6 @@ export default {
3438

3539
<template>
3640
<div :style="aspectRatioStyle" v-if="src">
37-
<iframe style="width: 100%; height: 100%" :src="src" :allow="props.embedAllow" />
41+
<iframe class="notion-asset-object-fit" :src="src" :allow="props.embedAllow" />
3842
</div>
3943
</template>

src/blocks/helpers/figure.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export default {
1616
}
1717
</script>
1818
<template>
19-
<figure class="notion-asset-wrapper" :style="width">
19+
<figure class="notion-asset-wrapper" :style="[isType('image') ? 'width:100%' : '']">
2020
<NotionImage v-if="isType('image')" v-bind="pass" />
2121
<NotionAsset v-else-if="isType(['embed', 'video', 'figma', 'maps'])" v-bind="pass" />
2222
<NotionGoogleDrive v-else-if="isType('drive')" v-bind="pass" />

src/components/block.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ if (!availableType.includes(type.value)) console.warn(`${type.value.toUpperCase(
3131

3232
<template>
3333
<div style="width: 100%" v-if="isType('page')">
34-
<NotionPage v-bind="pass">
34+
<NotionPage class="notion-page-content" v-bind="pass">
3535
<slot />
3636
</NotionPage>
3737
</div>

src/style.css

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,6 @@
156156

157157
.notion-page-content {
158158
width: 100%;
159-
display: flex;
160-
flex-direction: column;
161159
}
162160

163161
@media (min-width: 1300px) and (min-height: 300px) {
@@ -604,10 +602,10 @@ img.notion-page-icon-offset {
604602
padding-left: calc(min(12px, 8vw));
605603
padding-right: calc(min(12px, 8vw));
606604
}
607-
.notion-page > * {
605+
/* .notion-page > * {
608606
box-sizing: border-box;
609607
width: 100%;
610-
}
608+
} */
611609

612610
.notion-full-width {
613611
--notion-max-width: calc(min(1920px, 98vw));
@@ -782,7 +780,6 @@ svg.notion-page-icon {
782780
.notion-asset-wrapper {
783781
margin: 0.5rem 0;
784782
max-width: 100vw;
785-
width: 100%;
786783
min-width: 100%;
787784
align-self: center;
788785
display: flex;
@@ -2473,6 +2470,7 @@ svg.notion-page-icon {
24732470
.notion-tweet {
24742471
display: flex;
24752472
justify-content: center;
2473+
width: 100%;
24762474
}
24772475
.notion-tweet-error {
24782476
font-size: 0.8rem;

0 commit comments

Comments
 (0)