@@ -6,6 +6,8 @@ import { TinaMarkdown } from "tinacms/dist/rich-text";
66import { toolbarFields } from "@/tina/collection/shared/toolbarFields" ;
77import MarkdownComponentMapping from "../tina-markdown/markdown-component-mapping" ;
88import { Figure , inlineFigureDefaultItem , inlineFigureFields } from "./figure" ;
9+ import { youtubeEmbedTemplate } from "./youtubeEmbed" ;
10+ import { imageEmbedTemplate } from "./imageEmbed" ;
911
1012type BoxVariant = "greybox" | "info" | "todo" | "china" | "codeauditor" | "highlight" | "warning" | "tips" ;
1113
@@ -88,19 +90,14 @@ export function BoxEmbed(props: any) {
8890 const figure : string = data ?. figure || "" ;
8991 const figurePrefix : any = data ?. figurePrefix || "none" ;
9092
91- const components = {
92- ...MarkdownComponentMapping ,
93- a : ( { children } : any ) => < span > { children } </ span > ,
94- } ;
95-
9693 return (
9794 < >
9895 < div className = { `p-4 rounded-sm my-4 ${ config . containerClass } ` } >
9996 < div className = "flex items-start" >
10097 { config . icon }
10198 < div className = { `[&_p:last-child]:mb-0 ${ config . textClass ?? "" } ` } >
10299 < div >
103- < TinaMarkdown content = { data . body } components = { components } />
100+ < TinaMarkdown content = { data . body } components = { MarkdownComponentMapping } />
104101 </ div >
105102 </ div >
106103 </ div >
@@ -148,6 +145,7 @@ export const boxEmbedTemplate: Template = {
148145 label : "Body" ,
149146 type : "rich-text" ,
150147 toolbarOverride : toolbarFields ,
148+ templates : [ youtubeEmbedTemplate , imageEmbedTemplate ] ,
151149 } ,
152150 ...( inlineFigureFields as any ) ,
153151 ] ,
0 commit comments