File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -69,6 +69,12 @@ class ImageTransformer extends DomTransformer {
6969 imageElement.attributes['src' ] = 'https:$url ' ;
7070 }
7171 }
72+ } // src != null
73+ final style = imageElement.attributes['style' ];
74+ if (style == null ) {
75+ imageElement.attributes['style' ] = 'max-width: 100%;' ;
76+ } else if (! style.contains ('max-width' )) {
77+ imageElement.attributes['style' ] = '$style max-width: 100%;' ;
7278 }
7379 }
7480 // integrate other inline images:
@@ -85,8 +91,11 @@ class ImageTransformer extends DomTransformer {
8591 if (part != null ) {
8692 final data = toImageData (part, info.mediaType, configuration);
8793 final imageElement = Element .html (
88- '<a href="fetch://${info .fetchId }"><img src="$data " alt="${info .fileName }" /></a>' );
89- document.body! .append (imageElement);
94+ '<a href="fetch://${info .fetchId }">'
95+ '<img src="$data " alt="${info .fileName }" />'
96+ '</a>' ,
97+ );
98+ document.body? .append (imageElement);
9099 }
91100 }
92101 }
You can’t perform that action at this time.
0 commit comments