富文本编辑器kindeditors部分情况下会不显示dialog层
部分情况下弹出的层(图片)dialog弹框会不显示,一片白色
正常情况是这样的
异常情况是这样的
调试了一下kindeditor.js文件,发现有个方法自动给弹框dialog定位中间的,x和y(主要是y)变成了130.9999999带小数点的,导致top的class没生效,left是生效了,但是top没出来,正常弹框dialog是会有top的
只要在kindeditor.js文件autoPos: function (width, height) {方法(大概是3431行)加入下面这段代码即可
x = parseInt(x);
y = parseInt(y);
autoPos: function (width, height) {
var self = this,
w = _removeUnit(width) || 0,
h = _removeUnit(height) || 0,
scrollPos = _getScrollPos();
if (self._alignEl) {
var knode = K(self._alignEl),
pos = knode.pos(),
diffX = _round(knode[0].clientWidth / 2 - w / 2),
diffY = _round(knode[0].clientHeight / 2 - h / 2);
x = diffX < 0 ? pos.x : pos.x + diffX;
y = diffY < 0 ? pos.y : pos.y + diffY;
} else {
var docEl = _docElement(self.doc);
x = _round(scrollPos.x + (docEl.clientWidth - w) / 2);
y = _round(scrollPos.y + (docEl.clientHeight - h) / 2);
}
if (!(_IE && _V < 7 || _QUIRKS)) {
x -= scrollPos.x;
y -= scrollPos.y;
}
x = parseInt(x);
y = parseInt(y);
return self.pos(x, y);
},