File tree Expand file tree Collapse file tree 8 files changed +159
-515
lines changed Expand file tree Collapse file tree 8 files changed +159
-515
lines changed Original file line number Diff line number Diff line change 7474 "typescript" : " ^4.4.4" ,
7575 "vite" : " ^2.8.6" ,
7676 "vite-plugin-dts" : " ^0.9.10" ,
77- "vue-tsc" : " ^0.29.8 "
77+ "vue-tsc" : " ^0.34.11 "
7878 },
7979 "peerDependencies" : {
8080 "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"
1717import NotionTodo from " @/blocks/todo.vue"
1818import NotionToggle from " @/blocks/toggle.vue"
1919import NotionTableOfContents from " @/blocks/table-of-contents.vue"
20+ import NotionSyncBlock from " @/blocks/sync-block.vue"
21+ import NotionSyncPointerBlock from " @/blocks/sync-pointer-block.vue"
2022
2123const NotionCode = defineAsyncComponent (() => import (" @/blocks/code.vue" ))
2224
@@ -57,5 +59,7 @@ if (!availableType.includes(type.value)) console.warn(`${type.value.toUpperCase(
5759 <NotionTable v-else-if =" isType('table')" v-bind =" pass" ><slot /></NotionTable >
5860 <NotionTableRow v-else-if =" isType('table_row')" v-bind =" pass" />
5961 <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 >
6064 <hr v-else-if =" isType('divider')" class =" notion-hr" />
6165</template >
Original file line number Diff line number Diff line change @@ -79,7 +79,7 @@ export const useNotionBlock = (props: Readonly<NotionBlockProps>) => {
7979 return props . blockMap [ block . value ?. value . parent_id ]
8080 } )
8181
82- const isType = ( t : any ) => {
82+ const isType = ( t : string | string [ ] ) => {
8383 if ( Array . isArray ( t ) ) {
8484 return visible . value && t . includes ( type . value )
8585 }
Original file line number Diff line number Diff line change @@ -24,4 +24,6 @@ export const availableType = [
2424 "table_row" ,
2525 "divider" ,
2626 "table_of_contents" ,
27+ "transclusion_container" ,
28+ "transclusion_reference" ,
2729]
Original file line number Diff line number Diff line change @@ -1032,6 +1032,7 @@ svg.notion-page-icon {
10321032 align-items : center;
10331033 box-sizing : border-box;
10341034 margin : 4px 0 ;
1035+ align-items : flex-start;
10351036 /* border: 1px solid var(--fg-color-0); */
10361037}
10371038
You can’t perform that action at this time.
0 commit comments