Use responsive images (dimensions + srcset) with TinyMCE

I want to change the img tags generated by TinyMCE to react to this when the image is loaded, something like this (using lazysizes

):

<img
    data-sizes="auto"
    data-src="image2.jpg"
    data-srcset="image1.jpg 300w,
                 image2.jpg 600w,
                 image3.jpg 900w"
    class="lazyload" />

      

In the deprecated (and not useful to me) MCImageManager, you can do this :

imagemanager_insert_template : '<img src="{$url}" />'

      

Is there something like this in TinyMCE? Either mostly or in some (free) plugins? I have full control over the trailing end where I load the images and I already do the resizing there (using ImageSharp ).

+3


source to share





All Articles