ueditor二次开发:图片等比例拉伸 - 云起网

云起网

您现在的位置是:首页> 二次开发 -> ueditor二次开发:图片等比例拉伸

Article

ueditor二次开发:图片等比例拉伸

云起网2019-05-20 二次开发420

其实可以修改成等比拉伸 这样可以避免误操作引起的图片不好看的问题 :


    修改ueditor.all.js 大约16970行,如果是ueditor.all.min.js 那么你最好先更新下ueditor.all.js然后压缩成mini版


/* 把原来的代码注释掉
if (rect[dir][2] != 0) {
tmp = dom.clientWidth + rect[dir][2] * offset.x;
dom.style.width = me._validScaledProp('width', tmp) + 'px';
}
if (rect[dir][3] != 0) {
tmp = dom.clientHeight + rect[dir][3] * offset.y;
dom.style.height = me._validScaledProp('height', tmp) + 'px';
}*/
//等比缩放图片
if (rect[dir][2] != 0) {
tmp = dom.clientWidth + rect[dir][2] * offset.x;
var tmpwh = parseInt(dom.style.width)/parseInt(dom.style.height);
dom.style.width = me._validScaledProp('width', tmp) + 'px';
dom.style.height = me._validScaledProp('height', tmp/tmpwh) + 'px';
}
if (rect[dir][3] != 0) {
tmp = dom.clientHeight + rect[dir][3] * offset.y;
var tmpwh = parseInt(dom.style.width)/parseInt(dom.style.height);
dom.style.height = me._validScaledProp('height', tmp) + 'px';
dom.style.width = me._validScaledProp('width', tmp*tmpwh) + 'px';
}
--------------------- 
作者:北方的刀郎 
来源:CSDN 
原文:https://blog.csdn.net/forest_fire/article/details/50944923 
版权声明:本文为博主原创文章,转载请附上博文链接!


文章评论

共有0条评论来说两句吧...