Skip to content

Commit b806171

Browse files
committed
feat: support for todo items
1 parent c080f12 commit b806171

File tree

3 files changed

+35
-15
lines changed

3 files changed

+35
-15
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,8 @@ Most common block types are supported. We happily accept pull requests to add su
187187
| Page Links | ✅ Yes | |
188188
| Cover | ✅ Yes | Enable with `fullPage` |
189189
| Equations | ✅ Yes | |
190+
| Checkbox | ✅ Yes | |
190191
| Databases | ❌ Not planned | |
191-
| Checkbox | ❌ Not planned | |
192192
| Table Of Contents | ❌ Not planned | |
193193

194194
Please, feel free to [open an issue](https://github.com/janniks/vue-notion/issues/new) if you notice any important blocks missing or anything wrong with existing blocks.

src/blocks/todo.vue

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<template>
2+
<div>
3+
<input type="checkbox" :value="title" :checked="!!properties.checked" disabled="disabled" />
4+
<label>
5+
<NotionTextRenderer :text="title" v-bind="pass" />
6+
</label>
7+
</div>
8+
</template>
9+
10+
<script>
11+
import Blockable from "@/lib/blockable";
12+
import NotionTextRenderer from "@/blocks/helpers/text-renderer";
13+
14+
export default {
15+
extends: Blockable,
16+
name: "NotionTodo",
17+
components: {
18+
NotionTextRenderer
19+
},
20+
}
21+
</script>

src/components/block.vue

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
<template>
22
<div v-if="isType('page')">
3-
<NotionPage v-bind="pass"><slot /></NotionPage>
3+
<NotionPage v-bind="pass">
4+
<slot />
5+
</NotionPage>
46
</div>
5-
<NotionHeader
6-
v-else-if="isType(['header', 'sub_header', 'sub_sub_header'])"
7-
v-bind="pass"
8-
/>
7+
<NotionHeader v-else-if="isType(['header', 'sub_header', 'sub_sub_header'])" v-bind="pass" />
98
<NotionBookmark v-else-if="isType('bookmark')" v-bind="pass" />
109
<NotionCallout v-else-if="isType('callout')" v-bind="pass" />
1110
<NotionCode v-else-if="isType('code')" v-bind="pass" />
1211
<NotionEquation v-else-if="isType('equation')" v-bind="pass" />
1312
<NotionText v-else-if="isType('text')" v-bind="pass" />
1413
<NotionQuote v-else-if="isType('quote')" v-bind="pass" />
14+
<NotionTodo v-else-if="isType('to_do')" v-bind="pass" />
1515
<NotionToggle v-else-if="isType('toggle')" v-bind="pass">
1616
<slot />
1717
</NotionToggle>
@@ -21,18 +21,15 @@
2121
<NotionColumn v-else-if="isType('column')" :format="format">
2222
<slot />
2323
</NotionColumn>
24-
<NotionList
25-
v-else-if="isType(['bulleted_list', 'numbered_list'])"
26-
v-bind="pass"
27-
>
24+
<NotionList v-else-if="isType(['bulleted_list', 'numbered_list'])" v-bind="pass">
2825
<slot />
2926
</NotionList>
30-
<NotionFigure
31-
v-else-if="isType(['image', 'embed', 'figma', 'video'])"
32-
v-bind="pass"
33-
/>
27+
<NotionFigure v-else-if="isType(['image', 'embed', 'figma', 'video'])" v-bind="pass" />
3428
<hr v-else-if="isType('divider')" class="notion-hr" />
35-
<div v-else-if="todo && visible">todo: {{ type }}<slot /></div>
29+
<div v-else-if="todo && visible">
30+
todo: {{ type }}
31+
<slot />
32+
</div>
3633
<!-- todo: maybe add message on !production if block type unsupported -->
3734
<!-- <div v-else-if="visible"><slot /></div> -->
3835
</template>
@@ -51,6 +48,7 @@ import NotionText from "@/blocks/text";
5148
import NotionToggle from "@/blocks/toggle";
5249
import NotionQuote from "@/blocks/quote";
5350
import NotionEquation from "@/blocks/equation";
51+
import NotionTodo from "@/blocks/todo";
5452
5553
export default {
5654
extends: Blockable,
@@ -68,6 +66,7 @@ export default {
6866
NotionToggle,
6967
NotionQuote,
7068
NotionEquation,
69+
NotionTodo,
7170
},
7271
};
7372
</script>

0 commit comments

Comments
 (0)