...">

Redactor Editor Changes Image Tag On Upload

When uploading images through Redactor

Redactor will generate a tag <img src="blablabla.png"/>

What if I want the tag to look like:

<img class="myClass" src="blablabla.png"/>

How to do it?

I looked through all the APIs and the callback, but I did not find a way to implement this.

+4
source share
1 answer

It looks like you can use imageUploadCallback .

This callback is triggered when the image is loaded successfully, and the image DOM element is used for you.

$('#redactor').redactor({
    imageUploadCallback: function(image, json)
    {
        // image = this is DOM element of image
        // json = for example: { "filelink": "/images/img.jpg" }
    }
});
+3
source

Source: https://habr.com/ru/post/1542010/


All Articles