![](/img/trans.png)
[英]Force CKEditor image2 plugin to set width and heigth inside the syle
[英]How to automatically set title to be the same as alt for img tag when using ckeditor with image2 plugin?
我希望能够使用image2插件将title标签设置为ckeditor中的最终图像。 当我使用image2插件时,标题标签消失了。
我的页面上有一个完全可用的ckeditor,但希望有一个title标签,当将image插入image2对话框中给出的alt时会自动设置该title标签。 我花了几个小时寻找解决方案,但似乎没有人遇到同样的问题,所以我决定问是否有人知道解决方案。
我尝试使用CKEDITOR.replace方法在instanceReady上进行更改:
CKEDITOR.replace('element_id',{
on: {
instanceReady: function() {
this.dataProcessor.htmlFilter.addRules( {
elements: {
img: function( el ) {
el.attributes.title = el.attributes.alt;
}
}
});
}
}
});
但这没用..
尝试了这个答案https://stackoverflow.com/a/34330124
那也不起作用
我在ckeditor的config.js中将config.extraAllowedContent
设置为'*(*);*{*}'
,应允许所有标签和属性。
按照https://stackoverflow.com/a/34330124进行操作 ,也许您必须在image2 plugin.js中进行更多调整,但是之后必须为浏览器清除cahce,因为它永远不会更新。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.