@@ -74,6 +74,10 @@ export function pluginOptionsSchema({ Joi }) {
7474 . min ( 1 )
7575 . default ( 10 )
7676 . description ( `The number of promises to run at one time.` ) ,
77+ richTextEmbedTypeNames : Joi . array ( )
78+ . description ( 'An array of Rich Text fields that have embeds enabled' )
79+ . items ( Joi . string ( ) )
80+ . default ( [ ] ) ,
7781 } )
7882}
7983
@@ -219,6 +223,7 @@ export async function createSchemaCustomization(gatsbyApi, pluginOptions) {
219223 buildMarkdownNodes = false ,
220224 downloadLocalImages = false ,
221225 typePrefix = 'GraphCMS_' ,
226+ richTextEmbedTypeNames = [ ] ,
222227 } = pluginOptions
223228
224229 const config = await createSourcingConfig ( gatsbyApi , pluginOptions )
@@ -274,6 +279,13 @@ export async function createSchemaCustomization(gatsbyApi, pluginOptions) {
274279 type ${ typePrefix } RichText {
275280 markdownNode: ${ typePrefix } MarkdownNode @link
276281 }
282+ ${ richTextEmbedTypeNames . map (
283+ ( typeName ) => `
284+ type ${ typePrefix } ${ typeName } RichText implements Node {
285+ markdownNode: ${ typePrefix } MarkdownNode @link
286+ }
287+ `
288+ ) }
277289 ` )
278290}
279291
@@ -312,7 +324,9 @@ export async function onCreateNode(
312324 . map ( ( [ key , value ] ) => ( { key, value } ) )
313325 . filter (
314326 ( { value } ) =>
315- value && value . remoteTypeName && value . remoteTypeName === 'RichText'
327+ value &&
328+ value . remoteTypeName &&
329+ value . remoteTypeName . endsWith ( 'RichText' )
316330 )
317331
318332 if ( fields . length ) {
0 commit comments