Redactor editor change image tag when upload

你说的曾经没有我的故事 提交于 2019-12-10 09:26:08

问题


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.


回答1:


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!