You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Enhance Notion component with template support and version updates
- Added `listTemplates` method to the Notion client for retrieving available templates.
- Updated `create-page-from-database` action to support template selection, including new properties for template type and ID.
- Bumped version to 2.0.0 for the `create-page-from-database` action and updated package version to 1.0.6.
- Upgraded `@notionhq/client` dependency to version 5.3.0.
description: "Create a page from a data source. [See the documentation](https://developers.notion.com/reference/post-page)",
12
-
version: "1.1.0",
13
+
version: "2.0.0",
13
14
annotations: {
14
15
destructiveHint: false,
15
16
openWorldHint: true,
@@ -25,13 +26,26 @@ export default {
25
26
],
26
27
label: "Parent Data Source ID",
27
28
description: "Select a parent data source or provide a data source ID",
28
-
reloadProps: true,
29
29
},
30
-
Name: {
30
+
templateType: {
31
31
type: "string",
32
-
label: "Name",
33
-
description: "The name of the page. Use this only if the data source has a `title` property named `Name`. Otherwise, use the `Properties` prop below to set the title property.",
34
-
optional: true,
32
+
label: "Template Type",
33
+
description: "The type of template to use for the page. [See the documentation](https://developers.notion.com/docs/creating-pages-from-templates) for more information.",
34
+
options: [
35
+
{
36
+
label: "No template. Provided children and properties are immediately applied.",
37
+
value: "none",
38
+
},
39
+
{
40
+
label: "Applies the data source's default template to the newly created page. `children` cannot be specified in the create page request.",
41
+
value: "default",
42
+
},
43
+
{
44
+
label: "Indicates which exact template to apply to the newly created page. children cannot be specified in the create page request.",
content: "This action will create an empty page by default. To add content, use the `Page Content` prop below.",
98
+
},
99
+
...this.buildAdditionalProps({
100
+
properties: selectedProperties,
101
+
}),
102
+
};
103
+
case"default":
104
+
return{
105
+
alert: {
106
+
type: "alert",
107
+
alertType: "info",
108
+
content: "This action will create a page using the data source's default template. Using the `Page Content` prop below will `not` apply to the page.",
109
+
},
110
+
};
111
+
case"template_id":
112
+
return{
113
+
templateId: {
114
+
type: "string",
115
+
label: "Template ID",
116
+
description: "The ID of the template to use for the page. [See the documentation](https://developers.notion.com/docs/creating-pages-from-templates) for more information.",
117
+
options: async({ prevContext })=>{
118
+
const{
119
+
templates,next_cursor: nCursor,
120
+
}=awaitthis.notion.listTemplates({
121
+
data_source_id: this.parentDataSource,
122
+
start_cursor: prevContext?.nCursor,
123
+
});
124
+
return{
125
+
options: templates.map(({
126
+
name: label,id: value,
127
+
})=>({
128
+
label,
129
+
value,
130
+
})),
131
+
context: {
132
+
nCursor,
133
+
},
134
+
};
135
+
},
136
+
},
137
+
alert: {
138
+
type: "alert",
139
+
alertType: "info",
140
+
content: "This action will create a page using the selected template. Using the `Page Content` prop below will `not` apply to the page.",
0 commit comments