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..70210450 100644 --- a/packages/react-notion-x/src/components/asset.tsx +++ b/packages/react-notion-x/src/components/asset.tsx @@ -3,7 +3,12 @@ import { type BaseContentBlock, type Block } from 'notion-types' import { getTextContent } from 'notion-utils' import { useNotionContext } from '../context' -import { getUrlParams, getYoutubeId } from '../utils' +import { + deleteUrlParams, + getUrlParams, + getYoutubeId, + setUrlParams +} from '../utils' import { LazyImage } from './lazy-image' import { LiteYouTubeEmbed } from './lite-youtube-embed' @@ -135,9 +140,7 @@ export function Asset({ } if (block.space_id) { - const url = new URL(source) - url.searchParams.set('spaceId', block.space_id) - source = url.toString() + source = setUrlParams(source, { spaceId: block.space_id }) } let content = null @@ -187,6 +190,7 @@ export function Asset({ block.type === 'drive' || block.type === 'replit' ) { + let displaySource = block.format?.display_source if ( block.type === 'video' && source && @@ -200,19 +204,36 @@ export function Asset({ !source.includes('tella') ) { style.paddingBottom = undefined - + const videoTitle = block.format?.link_title || 'block.type' + if (displaySource) { + delete style.height + displaySource = deleteUrlParams(displaySource, ['spaceId']) + } content = ( -