Add column, column_list support (flatted into document until we have support)

This commit is contained in:
Tom Moor committed 2025-03-15 13:05:02 -04:00
1 parent e05c86a163
commit 528c752b1a
2 files changed
+71 -7

No files matched your search

+11 -7
View File
@@ -23,6 +23,8 @@ import type {
PageObjectResponse,
VideoBlockObjectResponse,
CalloutBlockObjectResponse,
ColumnListBlockObjectResponse,
ColumnBlockObjectResponse,
} from "@notionhq/client/build/src/api-endpoints";
import isArray from "lodash/isArray";
import { NoticeTypes } from "@shared/editor/nodes/Notice";
@@ -42,8 +44,6 @@ export class NotionConverter {
// TODO: Implement the following blocks:
// - "child_database"
// - "child_page"
// - "column"
// - "column_list"
// - "link_preview"
// - "link_to_page"
// - "synced_block"
@@ -52,11 +52,7 @@ export class NotionConverter {
* Nodes which cannot contain block children in Outline, their children
* will be flattened into the parent.
*/
private static nodesWithoutBlockChildren = [
// TODO.
"paragraph",
"toggle",
];
private static nodesWithoutBlockChildren = ["paragraph", "toggle"];
public static page(item: NotionPage) {
return {
@@ -178,6 +174,14 @@ export class NotionConverter {
};
}
private static column_list(item: NotionBlock<ColumnListBlockObjectResponse>) {
return this.mapChildren(item);
}
private static column(item: NotionBlock<ColumnBlockObjectResponse>) {
return this.mapChildren(item);
}
private static bookmark(item: BookmarkBlockObjectResponse) {
return {
type: "paragraph",
@@ -336,6 +336,66 @@ exports[`NotionConverter converts a page 1`] = `
],
"type": "paragraph",
},
{
"content": [
{
"marks": [
{
"type": "strong",
},
],
"text": "Column one content",
"type": "text",
},
],
"type": "paragraph",
},
{
"content": [
{
"marks": [],
"text": "It can have any node permissible in the page",
"type": "text",
},
],
"type": "paragraph",
},
{
"content": [],
"type": "paragraph",
},
{
"content": [
{
"marks": [
{
"type": "strong",
},
],
"text": "Column two content",
"type": "text",
},
],
"type": "paragraph",
},
{
"attrs": {
"style": "info",
},
"content": [
{
"content": [
{
"marks": [],
"text": "Callout inside column",
"type": "text",
},
],
"type": "paragraph",
},
],
"type": "container_notice",
},
{
"attrs": {
"level": 2,