如何将自定义宽度参数设置为 tinymce 创建的 img 标签?

编程入门 行业动态 更新时间:2024-10-22 11:39:36
本文介绍了如何将自定义宽度参数设置为 tinymce 创建的 img 标签?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

如何为tinymce创建的img标签设置自定义宽度参数?

How to set custom width parameter to img tag created by tinymce?

我的意思是,当您在 textarea 中插入图像时,如何将其宽度更改为某个自定义值?Image manager config没有提供这样的功能所以我想修改这个脚本,只需要知道从哪里开始

I mean when you inster the image in textarea, how to change it's width to some custom value ? Image managers config does not provide such feature so I want to modify this script, just need to know where to start

已解决这是我在 tinyMCE 初始化块中添加的脚本

SOLVED Here is my script that I added in tinyMCE initialization block

imagemanager_insert_template : function(fo, enc) {return '<img src=\"' + enc.xmlEncode(fo.url) + '\" width=\"$width_mini\" height=\"' + $width_mini/(fo.custom.width/fo.custom.height) + '\"/>';
    },

这就行了.

推荐答案

已回答但将作为回答发布以便其他人看到此问题有解决方案

Already answered but will post as answer so others will see that there is a solution for this problem

imagemanager_insert_template : function(fo, enc) {return '<img src=\"' + enc.xmlEncode(fo.url) + '\" width=\"$width_mini\" height=\"' + $width_mini/(fo.custom.width/fo.custom.height) + '\"/>';
    },

这篇关于如何将自定义宽度参数设置为 tinymce 创建的 img 标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

更多推荐

[db:关键词]

本文发布于:2023-04-30 09:29:11,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1391989.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:自定义   设置为   宽度   如何将   参数

发布评论

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

>www.elefans.com

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