UEditor 上传图片等比例缩放

修改ueditor.all.js 16995行 updateTargetElement: function(){}里的内容为

updateTargetElement: function () {
                var me = this;
				var newWidth = parseInt(me.resizer.style.width);
				// var newHeight = parseInt(me.resizer.style.height);
				var oldHeight = parseInt(me.target.naturalHeight);
				var oldWidth = parseInt(me.target.naturalWidth);
				var c =(oldHeight*newWidth)/oldWidth;
				domUtils.setStyles(me.target, {
				'width': me.resizer.style.width,
				'height': c+'px'
				});
				   var scale = parseInt(me.target.height)/parseInt(me.target.width);
				   me.target.width = parseInt(me.resizer.style.width);
				   me.target.height = parseInt(me.target.width)*scale;
				   me.target.width = parseInt(me.resizer.style.width);
				   me.target.height = parseInt(me.resizer.style.height);
				me.attachTo(me.target);
            },	

你可能感兴趣的:(UEditor)