Jquery Redactor图像调整大小添加内联样式属性,如何强制Redactor使用;宽度“;及;高度“;属性
编辑在调整大小时向img标记添加style属性Jquery Redactor图像调整大小添加内联样式属性,如何强制Redactor使用;宽度“;及;高度“;属性,jquery,width,wysiwyg,inline-styles,redactor,Jquery,Width,Wysiwyg,Inline Styles,Redactor,编辑在调整大小时向img标记添加style属性 <img src="image_url" style="width: 189.00884955752213px; height: 118px;" > 在Outlook桌面应用程序中查看时,此内联css不会影响图像大小 在做了一些研究之后,我发现只有在图像标签中使用宽度和高度属性指定大小时,Outlook才会以所需大小显示图像 由Redactor生成的style属性中的宽度值也不是整数189.00884955752213px 如何解
<img src="image_url" style="width: 189.00884955752213px; height: 118px;" >
在Outlook桌面应用程序中查看时,此内联css不会影响图像大小
在做了一些研究之后,我发现只有在图像标签中使用宽度和高度属性指定大小时,Outlook才会以所需大小显示图像
由Redactor生成的style属性中的宽度值也不是整数189.00884955752213px
如何解决这两个问题我使用syncBeforeCallback方法解决了这个问题,以确保图像还具有outlook的宽度属性
syncBeforeCallback: function (html)
{
// set image width as attribute (for outlook)
var $html = $('<div/>').html(html);
$html.find('img').each(function copyImageCssWidthToAttribute() {
var width = parseInt($(this).css('width'));
if (width > 0) {
$(this).attr('width', width);
}
});
html = $html.html();
return html;
},
syncBeforeCallback:function(html)
{
//将图像宽度设置为属性(对于outlook)
var$html=$('').html(html);
$html.find('img')。每个(函数copyImageCssWidthToAttribute(){
var-width=parseInt($(this.css('width'));
如果(宽度>0){
$(this.attr('width',width);
}
});
html=$html.html();
返回html;
},
我没有找到任何定义高度的情况。我使用syncBeforeCallback方法解决了这个问题,以确保图像也具有outlook的宽度属性
syncBeforeCallback: function (html)
{
// set image width as attribute (for outlook)
var $html = $('<div/>').html(html);
$html.find('img').each(function copyImageCssWidthToAttribute() {
var width = parseInt($(this).css('width'));
if (width > 0) {
$(this).attr('width', width);
}
});
html = $html.html();
return html;
},
syncBeforeCallback:function(html)
{
//将图像宽度设置为属性(对于outlook)
var$html=$('').html(html);
$html.find('img')。每个(函数copyImageCssWidthToAttribute(){
var-width=parseInt($(this.css('width'));
如果(宽度>0){
$(this.attr('width',width);
}
});
html=$html.html();
返回html;
},
我没有发现任何定义高度的案例