脚本宝典收集整理的这篇文章主要介绍了php – CKEditor对齐图像而不是浮动,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
我在我的应用程序中非常成功地使用CKEdITor,允许客户端构建和发送HTML电子邮件.只有一个障碍–CK使用style =“float:left”用于图像,而Outlook拒绝接受它是有效的(方式去,微软..)fcKEditor曾经使用对齐而不是浮点来定位图像.有没有办法破解CKEditor在图像对齐方面的行为?
在CK的论坛上发帖是徒劳的.任何帮助表示赞赏!
CKEDITOR.on('instanceReady',function (ev) { // Ends self closing tags the HTML4 way,like <br>. ev.editor.dataPRocessor.htmlFilter.addRules( { elements: { $: function (element) { // Output dimensions of images as width and height if (element.name == 'img') { VAR style = element.attributes.style; if (style) { // Get the width From the style. var match = /(?:^|\s)width\s*:\s*(\d+)px/i.exec(style),width = match && match[1]; // Get the height from the style. match = /(?:^|\s)height\s*:\s*(\d+)px/i.exec(style); var height = match && match[1]; // Get the align from the style var match = /(?:^|\s)float\s*:\s*(left|right)/i.exec(style),align = match && match[1]; if (width) { element.attributes.style = element.attributes.style.replace(/(?:^|\s)width\s*:\s*(\d+)px;?/i,''); element.attributes.width = width; } if (height) { element.attributes.style = element.attributes.style.replace(/(?:^|\s)height\s*:\s*(\d+)px;?/i,''); element.attributes.height = height; } if (align) { element.attributes.style = element.attributes.style.replace(/(?:^|\s)float\s*:\s*(left|right);?/i,''); element.attributes.align = align; } } } if (!element.attributes.style) delete element.attributes.style; return element; } } }); });
以上是脚本宝典为你收集整理的php – CKEditor对齐图像而不是浮动全部内容,希望文章能够帮你解决php – CKEditor对齐图像而不是浮动所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。