mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
feat(Notion Node): Add image block (#5237)
This commit is contained in:
@@ -154,6 +154,10 @@ export function getBlockTypes() {
|
||||
name: 'Numbered List Item',
|
||||
value: 'numbered_list_item',
|
||||
},
|
||||
{
|
||||
name: 'Image',
|
||||
value: 'image',
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
@@ -252,6 +256,15 @@ function getTexts(
|
||||
return results;
|
||||
}
|
||||
|
||||
function getTextBlocks(block: IDataObject) {
|
||||
return {
|
||||
text:
|
||||
block.richText === false
|
||||
? formatText(block.textContent as string).text
|
||||
: getTexts(((block.text as IDataObject).text as any) || []),
|
||||
};
|
||||
}
|
||||
|
||||
export function formatBlocks(blocks: IDataObject[]) {
|
||||
const results = [];
|
||||
for (const block of blocks) {
|
||||
@@ -260,9 +273,9 @@ export function formatBlocks(blocks: IDataObject[]) {
|
||||
type: block.type,
|
||||
[block.type as string]: {
|
||||
...(block.type === 'to_do' ? { checked: block.checked } : {}),
|
||||
// prettier-ignore
|
||||
|
||||
text: (block.richText === false) ? formatText(block.textContent as string).text : getTexts((block.text as IDataObject).text as any || []),
|
||||
...(block.type === 'image' ? { type: 'external', external: { url: block.url } } : {}),
|
||||
// prettier-ignore,
|
||||
...(!['to_do', 'image'].includes(block.type as string) ? getTextBlocks(block) : {}),
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user