@@ -74,6 +74,10 @@ export function pluginOptionsSchema({ Joi }) {
74
74
. min ( 1 )
75
75
. default ( 10 )
76
76
. 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 ( [ ] ) ,
77
81
} )
78
82
}
79
83
@@ -219,6 +223,7 @@ export async function createSchemaCustomization(gatsbyApi, pluginOptions) {
219
223
buildMarkdownNodes = false ,
220
224
downloadLocalImages = false ,
221
225
typePrefix = 'GraphCMS_' ,
226
+ richTextEmbedTypeNames = [ ] ,
222
227
} = pluginOptions
223
228
224
229
const config = await createSourcingConfig ( gatsbyApi , pluginOptions )
@@ -274,6 +279,13 @@ export async function createSchemaCustomization(gatsbyApi, pluginOptions) {
274
279
type ${ typePrefix } RichText {
275
280
markdownNode: ${ typePrefix } MarkdownNode @link
276
281
}
282
+ ${ richTextEmbedTypeNames . map (
283
+ ( typeName ) => `
284
+ type ${ typePrefix } ${ typeName } RichText implements Node {
285
+ markdownNode: ${ typePrefix } MarkdownNode @link
286
+ }
287
+ `
288
+ ) }
277
289
` )
278
290
}
279
291
@@ -312,7 +324,9 @@ export async function onCreateNode(
312
324
. map ( ( [ key , value ] ) => ( { key, value } ) )
313
325
. filter (
314
326
( { value } ) =>
315
- value && value . remoteTypeName && value . remoteTypeName === 'RichText'
327
+ value &&
328
+ value . remoteTypeName &&
329
+ value . remoteTypeName . endsWith ( 'RichText' )
316
330
)
317
331
318
332
if ( fields . length ) {
0 commit comments