@@ -3,7 +3,6 @@ import { AssetModel } from '../Models/asset-model';
33import { RenderOption , RenderObject , RenderContentType } from '../options/index' ;
44import { EmbeddedAsset , EmbeddedEntry , Attributes } from '../Models/embed-attributes-model' ;
55import { defaultOptions } from '../options/default-options' ;
6- import ASSET from '../embedded-types/asset' ;
76
87// This function will find Embedded object present in string
98export function findEmbeddedEntry (
@@ -33,11 +32,11 @@ export function findEmbeddedObjects(object: Attributes, entry: Entry): (ContentT
3332 return findEmbeddedEntry (
3433 embeddedEntry [ 'data-sys-entry-uid' ] ,
3534 embeddedEntry [ 'data-sys-content-type-uid' ] ,
36- entry . _embedded_entries ,
35+ Object . values ( entry . _embedded_entries || [ ] ) . reduce ( ( accumulator , value ) => accumulator . concat ( value ) , [ ] ) ,
3736 ) ;
3837 } else {
3938 const embeddedAsset = object as EmbeddedAsset ;
40- return findEmbeddedAsset ( embeddedAsset [ 'data-sys-asset-uid' ] , entry . _embedded_assets ) ;
39+ return findEmbeddedAsset ( embeddedAsset [ 'data-sys-asset-uid' ] , Object . values ( entry . _embedded_assets || [ ] ) . reduce ( ( accumulator , value ) => accumulator . concat ( value ) , [ ] ) , ) ;
4140 }
4241 }
4342 return [ ] ;
@@ -61,6 +60,12 @@ export function findRenderString(
6160 renderFunction [ ( object as EmbeddedEntry ) [ 'data-sys-content-type-uid' ] ] !== undefined
6261 ) {
6362 return ( renderFunction as RenderContentType ) [ ( object as EmbeddedEntry ) [ 'data-sys-content-type-uid' ] ] ( renderModel , object ) ;
63+ } else if (
64+ ( object as EmbeddedEntry ) [ 'data-sys-content-type-uid' ] !== undefined &&
65+ typeof renderFunction !== 'function' &&
66+ ( renderFunction as RenderContentType ) . $default !== undefined
67+ ) {
68+ return ( renderFunction as RenderContentType ) . $all ( renderModel , object ) ;
6469 } else if ( typeof renderFunction === 'function' ) {
6570 return renderFunction ( renderModel , object ) ;
6671 }
0 commit comments