@@ -122,7 +122,10 @@ private function addClass($type, $alignment = false, $style = false)
122
122
}
123
123
124
124
if ($ style ) {
125
- $ class [] = $ this ->prefix .'_ ' .$ style ;
125
+ $ styles = explode (' ' , $ style );
126
+ foreach ($ styles as $ v ) {
127
+ $ class [] = $ this ->prefix .'_ ' .$ v ;
128
+ }
126
129
}
127
130
128
131
return implode (' ' , $ class );
@@ -327,6 +330,8 @@ private function parseImage($block)
327
330
328
331
$ attrs = [];
329
332
333
+ $ caption = (!empty ($ block ->data ->caption )) ? $ block ->data ->caption : '' ;
334
+
330
335
if ($ block ->data ->withBorder ) $ attrs [] = "withborder " ;
331
336
if ($ block ->data ->withBackground ) $ attrs [] = "withbackground " ;
332
337
if ($ block ->data ->stretched ) $ attrs [] = "stretched " ;
@@ -340,13 +345,13 @@ private function parseImage($block)
340
345
$ img = $ this ->dom ->createElement ('img ' );
341
346
342
347
$ img ->setAttribute ('src ' , $ block ->data ->url );
343
- $ img ->setAttribute ('alt ' , '' );
348
+ $ img ->setAttribute ('alt ' , $ caption );
344
349
345
350
$ figure ->appendChild ($ img );
346
351
347
- if (!empty ($ block -> data -> caption )) {
352
+ if (!empty ($ caption )) {
348
353
$ figCaption = $ this ->dom ->createElement ('figcaption ' );
349
- $ figCaption ->appendChild ($ this ->html5 ->loadHTMLFragment ($ block -> data -> caption ));
354
+ $ figCaption ->appendChild ($ this ->html5 ->loadHTMLFragment ($ caption ));
350
355
$ figure ->appendChild ($ figCaption );
351
356
}
352
357
@@ -359,6 +364,8 @@ private function parseStandardImage($block)
359
364
360
365
$ attrs = [];
361
366
367
+ $ caption = (!empty ($ block ->data ->caption )) ? $ block ->data ->caption : '' ;
368
+
362
369
if ($ block ->data ->withBorder ) $ attrs [] = "withborder " ;
363
370
if ($ block ->data ->withBackground ) $ attrs [] = "withbackground " ;
364
371
if ($ block ->data ->stretched ) $ attrs [] = "stretched " ;
@@ -372,13 +379,13 @@ private function parseStandardImage($block)
372
379
$ img = $ this ->dom ->createElement ('img ' );
373
380
374
381
$ img ->setAttribute ('src ' , $ block ->data ->url );
375
- $ img ->setAttribute ('alt ' , '' );
382
+ $ img ->setAttribute ('alt ' , $ caption );
376
383
377
384
$ figure ->appendChild ($ img );
378
385
379
- if (!empty ($ block -> data -> caption )) {
386
+ if (!empty ($ caption )) {
380
387
$ figCaption = $ this ->dom ->createElement ('figcaption ' );
381
- $ figCaption ->appendChild ($ this ->html5 ->loadHTMLFragment ($ block -> data -> caption ));
388
+ $ figCaption ->appendChild ($ this ->html5 ->loadHTMLFragment ($ caption ));
382
389
$ figure ->appendChild ($ figCaption );
383
390
}
384
391
0 commit comments