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

筅森魡賤 提交于 2020-01-06 04:56:06

问题


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

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

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) + '\"/>';
    },

That does the trick.


回答1:


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) + '\"/>';
    },


来源:https://stackoverflow.com/questions/6889111/how-to-set-custom-width-parameter-to-img-tag-created-by-tinymce

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