export function deserialize( node ) { const normalized = { media: assign( { transient: false, }, node ), appearance: {}, }; // Infer media type switch ( getMimePrefix( node ) ) { case 'image': normalized.type = MediaTypes.IMAGE; break; case 'audio': normalized.type = MediaTypes.AUDIO; break; case 'video': normalized.type = MediaTypes.VIDEO; break; } return normalized; }
get: function( site, media, options ) { if ( ! media || media.hasOwnProperty( 'status' ) ) { return ''; } const mimePrefix = MediaUtils.getMimePrefix( media ); // Attempt to find a matching function in the mimeTypes object using // the MIME type prefix if ( mimePrefix && 'function' === typeof Markup.mimeTypes[ mimePrefix ] ) { return Markup.mimeTypes[ mimePrefix ]( site, media, options ); } return Markup.link( media ); },