From cd2630a06deccedcfa68f4dc0cb552fedc48fff5 Mon Sep 17 00:00:00 2001 From: anime Date: Mon, 14 Jul 2025 14:24:01 +0800 Subject: [PATCH 1/7] feat(asset): support external video sources with Notion-style rendering - add display_source handling for video blocks - implement iframe rendering for external video sources - add link_title support in block format - adjust video rendering based on display_source presence --- packages/notion-types/src/block.ts | 2 + .../react-notion-x/src/components/asset.tsx | 37 ++++++++++++++----- 2 files changed, 29 insertions(+), 10 deletions(-) diff --git a/packages/notion-types/src/block.ts b/packages/notion-types/src/block.ts index 48140b8c..7edb4fa5 100644 --- a/packages/notion-types/src/block.ts +++ b/packages/notion-types/src/block.ts @@ -133,6 +133,7 @@ export interface BaseContentBlock extends BaseBlock { caption?: Decoration[] } format?: { + link_title: string block_alignment: 'center' | 'left' | 'right' block_width: number block_height: number @@ -359,6 +360,7 @@ export interface GoogleDriveBlock extends BaseContentBlock { user_name: string modified_time: number } + link_title: string block_alignment: 'center' | 'left' | 'right' block_width: number block_height: number diff --git a/packages/react-notion-x/src/components/asset.tsx b/packages/react-notion-x/src/components/asset.tsx index d85c24b2..28bf63f2 100644 --- a/packages/react-notion-x/src/components/asset.tsx +++ b/packages/react-notion-x/src/components/asset.tsx @@ -187,6 +187,7 @@ export function Asset({ block.type === 'drive' || block.type === 'replit' ) { + const displaySource = block.format?.display_source if ( block.type === 'video' && source && @@ -200,19 +201,35 @@ export function Asset({ !source.includes('tella') ) { style.paddingBottom = undefined - + const vidoeTitle = block.format?.link_title || 'block.type' + if (displaySource && style.height) { + delete style.height + } content = ( -