When Uploading a image through Redactor
Redactor will generate <img src="blablabla.png"/>
tag
What if I want the tag is like:
<img class="myClass" src="blablabla.png"/>
How to do this?
I have viewed all the API and Callback but I didn't find any method to implement this.
It looks like you can use the imageUploadCallback.
This callback is triggered on successful image upload and the image DOM element is there for you to manipulate.
$('#redactor').redactor({
imageUploadCallback: function(image, json)
{
// image = this is DOM element of image
// json = for example: { "filelink": "/images/img.jpg" }
}
});
来源:https://stackoverflow.com/questions/23865048/redactor-editor-change-image-tag-when-upload