@@ -240,9 +240,8 @@ private function parseLink($block)
240
240
241
241
private function parseEmbed ($ block )
242
242
{
243
- $ wrapper = $ this ->dom ->createElement ('div ' );
244
-
245
- $ wrapper ->setAttribute ('class ' , "{$ this ->prefix }-embed " );
243
+ $ figure = $ this ->dom ->createElement ('figure ' );
244
+ $ figure ->setAttribute ('class ' , $ block ->type );
246
245
247
246
switch ($ block ->data ->service ) {
248
247
case 'youtube ' :
@@ -254,22 +253,25 @@ private function parseEmbed($block)
254
253
'allowfullscreen ' => true
255
254
];
256
255
257
- $ wrapper ->appendChild ($ this ->createIframe ($ attrs ));
258
-
259
256
break ;
260
- case 'codepen ' || 'gfycat ' :
257
+ // case 'codepen' || 'gfycat':
258
+ default :
261
259
262
260
$ attrs = [
263
261
'height ' => $ block ->data ->height ,
264
262
'src ' => $ block ->data ->embed ,
265
263
];
264
+ }
266
265
267
- $ wrapper ->appendChild ($ this ->createIframe ($ attrs ));
266
+ $ figure ->appendChild ($ this ->createIframe ($ attrs ));
268
267
269
- break ;
268
+ if ($ block ->data ->caption ) {
269
+ $ figCaption = $ this ->dom ->createElement ('figcaption ' );
270
+ $ figCaption ->appendChild ($ this ->html5 ->loadHTMLFragment ($ block ->data ->caption ));
271
+ $ figure ->appendChild ($ figCaption );
270
272
}
271
273
272
- $ this ->dom ->appendChild ($ wrapper );
274
+ $ this ->dom ->appendChild ($ figure );
273
275
}
274
276
275
277
private function createIframe (array $ attrs )
0 commit comments