Redactor编辑器在上传时更改图像标记(Redactor editor change image tag when upload)
通过Redactor上传图像时
Redactor将生成<img src="blablabla.png"/>标签
如果我想要标签怎么样:
<img class="myClass" src="blablabla.png"/>这个怎么做?
我查看了所有的API和回调,但我没有找到任何方法来实现它。
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.
最满意答案
看起来你可以使用imageUploadCallback 。
成功上传图像后会触发此回调,您可以使用图像DOM元素进行操作。
$('#redactor').redactor({ imageUploadCallback: function(image, json) { // image = this is DOM element of image // json = for example: { "filelink": "/images/img.jpg" } } });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" } } });更多推荐
发布评论