File tree 8 files changed +159
-515
lines changed
8 files changed +159
-515
lines changed Original file line number Diff line number Diff line change 74
74
"typescript" : " ^4.4.4" ,
75
75
"vite" : " ^2.8.6" ,
76
76
"vite-plugin-dts" : " ^0.9.10" ,
77
- "vue-tsc" : " ^0.29.8 "
77
+ "vue-tsc" : " ^0.34.11 "
78
78
},
79
79
"peerDependencies" : {
80
80
"fragment-for-vue" : " ^1.0.1" ,
Original file line number Diff line number Diff line change
1
+ <script setup lang="ts"></script >
2
+
3
+ <template >
4
+ <div class =" notion-sync-block" ><slot /></div >
5
+ </template >
6
+
7
+ <script lang="ts">
8
+ export default {
9
+ name: " NotionSyncBlock" ,
10
+ }
11
+ </script >
Original file line number Diff line number Diff line change
1
+ <script setup lang="ts">
2
+ import { computed } from " vue"
3
+ import { useNotionBlock , defineNotionProps } from " @/lib/blockable"
4
+ import NotionRenderer from " @/components/notion-renderer.vue"
5
+
6
+ const props = defineProps ({ ... defineNotionProps })
7
+ // @ts-ignore
8
+ const { block, pass } = useNotionBlock (props )
9
+
10
+ const referencePointerId = computed (
11
+ () => (block .value .value .format ?.transclusion_reference_pointer ?.id as string ) ?? " "
12
+ )
13
+ </script >
14
+
15
+ <template >
16
+ <NotionRenderer
17
+ v-bind =" pass"
18
+ :key =" referencePointerId"
19
+ :level =" pass.level + 1"
20
+ :content-id =" referencePointerId"
21
+ ></NotionRenderer >
22
+ </template >
23
+
24
+ <script lang="ts">
25
+ export default {
26
+ name: " NotionSyncPointerBlock" ,
27
+ }
28
+ </script >
Original file line number Diff line number Diff line change @@ -17,6 +17,8 @@ import NotionText from "@/blocks/text.vue"
17
17
import NotionTodo from " @/blocks/todo.vue"
18
18
import NotionToggle from " @/blocks/toggle.vue"
19
19
import NotionTableOfContents from " @/blocks/table-of-contents.vue"
20
+ import NotionSyncBlock from " @/blocks/sync-block.vue"
21
+ import NotionSyncPointerBlock from " @/blocks/sync-pointer-block.vue"
20
22
21
23
const NotionCode = defineAsyncComponent (() => import (" @/blocks/code.vue" ))
22
24
@@ -57,5 +59,7 @@ if (!availableType.includes(type.value)) console.warn(`${type.value.toUpperCase(
57
59
<NotionTable v-else-if =" isType('table')" v-bind =" pass" ><slot /></NotionTable >
58
60
<NotionTableRow v-else-if =" isType('table_row')" v-bind =" pass" />
59
61
<NotionTableOfContents v-else-if =" isType('table_of_contents')" v-bind =" pass" ></NotionTableOfContents >
62
+ <NotionSyncBlock v-else-if =" isType('transclusion_container')" ><slot /></NotionSyncBlock >
63
+ <NotionSyncPointerBlock v-else-if =" isType('transclusion_reference')" v-bind =" pass" ></NotionSyncPointerBlock >
60
64
<hr v-else-if =" isType('divider')" class =" notion-hr" />
61
65
</template >
Original file line number Diff line number Diff line change @@ -79,7 +79,7 @@ export const useNotionBlock = (props: Readonly<NotionBlockProps>) => {
79
79
return props . blockMap [ block . value ?. value . parent_id ]
80
80
} )
81
81
82
- const isType = ( t : any ) => {
82
+ const isType = ( t : string | string [ ] ) => {
83
83
if ( Array . isArray ( t ) ) {
84
84
return visible . value && t . includes ( type . value )
85
85
}
Original file line number Diff line number Diff line change @@ -24,4 +24,6 @@ export const availableType = [
24
24
"table_row" ,
25
25
"divider" ,
26
26
"table_of_contents" ,
27
+ "transclusion_container" ,
28
+ "transclusion_reference" ,
27
29
]
Original file line number Diff line number Diff line change @@ -1032,6 +1032,7 @@ svg.notion-page-icon {
1032
1032
align-items : center;
1033
1033
box-sizing : border-box;
1034
1034
margin : 4px 0 ;
1035
+ align-items : flex-start;
1035
1036
/* border: 1px solid var(--fg-color-0); */
1036
1037
}
1037
1038
You can’t perform that action at this time.
0 commit comments