@@ -333,6 +333,8 @@ protected function diffIsolatedPlaceholder($operation, $pos, $placeholder, $stri
333
333
return $ this ->diffElementsByAttribute ($ oldText , $ newText , 'href ' , 'a ' );
334
334
} elseif ($ this ->isImagePlaceholder ($ placeholder )) {
335
335
return $ this ->diffElementsByAttribute ($ oldText , $ newText , 'src ' , 'img ' );
336
+ } elseif ($ this ->isPicturePlaceholder ($ placeholder )) {
337
+ return $ this ->diffPicture ($ oldText , $ newText );
336
338
}
337
339
338
340
return $ this ->diffElements ($ oldText , $ newText , $ stripWrappingTags );
@@ -393,6 +395,23 @@ protected function diffTables($oldText, $newText)
393
395
return $ diff ->build ();
394
396
}
395
397
398
+ /**
399
+ * @param string $oldText
400
+ * @param string $newText
401
+ *
402
+ * @return string
403
+ */
404
+ protected function diffPicture ($ oldText , $ newText ) {
405
+ if ($ oldText !== $ newText ) {
406
+ return sprintf (
407
+ '%s%s ' ,
408
+ $ this ->wrapText ($ oldText , 'del ' , 'diffmod ' ),
409
+ $ this ->wrapText ($ newText , 'ins ' , 'diffmod ' )
410
+ );
411
+ }
412
+ return $ this ->diffElements ($ oldText , $ newText );
413
+ }
414
+
396
415
protected function diffElementsByAttribute ($ oldText , $ newText , $ attribute , $ element )
397
416
{
398
417
$ oldAttribute = $ this ->getAttributeFromTag ($ oldText , $ attribute );
@@ -475,6 +494,11 @@ public function isImagePlaceholder($text)
475
494
return $ this ->isPlaceholderType ($ text , 'img ' );
476
495
}
477
496
497
+ public function isPicturePlaceholder ($ text )
498
+ {
499
+ return $ this ->isPlaceholderType ($ text , 'picture ' );
500
+ }
501
+
478
502
/**
479
503
* @param string $text
480
504
* @param array|string $types
0 commit comments