Redactor编辑器在上传时更改图像标记(Redactor editor change image tag when upload)

系统教程 行业动态 更新时间:2024-06-14 17:04:03
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" } } });

更多推荐

本文发布于:2023-04-24 21:18:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/dzcp/215847a88d980461236317d259e8bb9c.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:编辑器   标记   图像   上传   Redactor

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!