File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2,27 +2,23 @@ import React from 'react';
22import { isJSON } from '@/util/utils' ;
33import { DotBlockEditor } from '../shared/dotBlockEditor' ;
44interface WebPageContentProps {
5- title : string ;
6- body : string ;
5+ title ? : string ;
6+ body ? : string | { json ?: string ; content ?: unknown [ ] } ;
77}
88
99const WebPageContent : React . FC < WebPageContentProps > = ( contentlet ) => {
1010 const { title, body } = contentlet ;
11+ const raw = ( body as any ) ?. json ?? body ;
12+ const blocks = typeof raw === "string" && isJSON ( raw ) ? JSON . parse ( raw ) : raw ;
1113
1214 return (
1315 < article className = "w-full" >
14-
1516 < div className = "prose dark:prose-invert max-w-none" >
16- { isJSON ( body ) ? (
17- < DotBlockEditor
18- blocks = { typeof body === 'string' ? JSON . parse ( body ) : body }
19- customRenderers = { { } }
20- />
21- ) : (
22- < >
23- < div dangerouslySetInnerHTML = { { __html : body } } />
24- </ >
25- ) }
17+ { blocks ?. content != null ? (
18+ < DotBlockEditor blocks = { blocks } customRenderers = { { } } />
19+ ) : typeof body === "string" ? (
20+ < div dangerouslySetInnerHTML = { { __html : body } } />
21+ ) : null }
2622 </ div >
2723 </ article >
2824 ) ;
Original file line number Diff line number Diff line change @@ -148,15 +148,22 @@ function VideoContentlet({ node }) {
148148}
149149
150150/**
151- * dotVideo block renderer — matches marketing site pattern: pass attrs.data into Video component .
152- * Custom renderer receives { node }; node.attrs.data holds the video/contentlet data .
151+ * dotVideo block renderer — pass contentlet (attrs.data) plus resolved attrs (src, mimeType, etc.) into Video.
152+ * Block editor may put the resolved URL in node.attrs.src; contentlet has asset/thumbnail etc .
153153 */
154154export const VidContent = ( props ) => {
155155 const attrs = props . attrs || props . node ?. attrs || { } ;
156156 const data = attrs . data ?? attrs ;
157+ const videoProps = {
158+ ...data ,
159+ src : attrs . src ?? data . src ,
160+ mimeType : attrs . mimeType ?? data . mimeType ,
161+ width : attrs . width ?? data . width ,
162+ height : attrs . height ?? data . height ,
163+ } ;
157164 return (
158165 < div className = "my-1" >
159- < Video { ...data } />
166+ < Video { ...videoProps } />
160167 </ div >
161168 ) ;
162169} ;
You can’t perform that action at this time.
0 commit comments