上载时Redactor编辑器更改图像标签 [英] Redactor editor change image tag when upload

查看:104
本文介绍了上载时Redactor编辑器更改图像标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通过Redactor上传图像时

When Uploading a image through Redactor

Redactor将生成<img src="blablabla.png"/>标签

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

如果我想要标签怎么办?

What if I want the tag is like:

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

如何执行此操作?

我已经查看了所有API和回调,但是没有找到实现此目的的任何方法.

I have viewed all the API and Callback but I didn't find any method to implement this.

推荐答案

您似乎可以使用 imageUploadCallback .

成功上传图片后会触发此回调,并且图片DOM元素可供您操纵.

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" }
    }
});

这篇关于上载时Redactor编辑器更改图像标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆