提交 ca356efd 编写于 作者: NoSubject's avatar NoSubject

优化正文输入时的高度计算,增加o2.defer方法

上级 6c56da4d
......@@ -2126,6 +2126,13 @@ if (!window.o2) {
o2.promiseAll = _promiseAll;
})();
o2.defer = function(fn, timer, bind, pars){
if (fn.timerId) clearTimeout(fn.timerId);
fn.timerId = setTimeout(function(){
fn.timerId = null;
fn.apply((bind || this), pars);
}, timer);
}
o2.core = true;
......
......@@ -1803,12 +1803,18 @@ MWF.xApplication.process.Xform.Documenteditor = MWF.APPDocumenteditor = new Cla
reLocationFiletextToolbarEvent: function(editorName){
if (Browser.ie11){
if (!this.waitLocationFiletext){
this.waitLocationFiletext = window.setTimeout(function(){
this.reLocationFiletextToolbar(editorName);
this.waitLocationFiletext = false;
}.bind(this), 1000);
}
o2.defer(this.reLocationFiletextToolbar, 500, this, [editorName]);
// if (this.waitLocationFiletext) window.clearTimeout(this.waitLocationFiletext);
// this.waitLocationFiletext = window.setTimeout(function(){
// this.reLocationFiletextToolbar(editorName);
// this.waitLocationFiletext = false;
// }.bind(this), 500);
// if (!this.waitLocationFiletext){
// this.waitLocationFiletext = window.setTimeout(function(){
// this.reLocationFiletextToolbar(editorName);
// this.waitLocationFiletext = false;
// }.bind(this), 1000);
// }
}else{
this.reLocationFiletextToolbar(editorName)
}
......@@ -2917,20 +2923,19 @@ debugger;
}.bind(this) );
editor.on( 'change', function( e ) {
//editor.on( 'change', function( e ) {
var h = document.documentElement.scrollTop;
var scrollNode = this.contentNode;
while (scrollNode && (scrollNode.getScrollSize().y<=scrollNode.getSize().y || (scrollNode.getStyle("overflow")!=="auto" && scrollNode.getStyle("4-y")!=="auto"))){
scrollNode = scrollNode.getParent();
}
if (scrollNode){
var top = scrollNode.scrollTop.toFloat();
scrollNode.scrollTop = h+top;
}
document.documentElement.scrollTop = 0;
var h = document.documentElement.scrollTop;
var scrollNode = this.contentNode;
while (scrollNode && (scrollNode.getScrollSize().y<=scrollNode.getSize().y || (scrollNode.getStyle("overflow")!=="auto" && scrollNode.getStyle("4-y")!=="auto"))){
scrollNode = scrollNode.getParent();
}
if (scrollNode){
var top = scrollNode.scrollTop.toFloat();
scrollNode.scrollTop = h+top;
}
document.documentElement.scrollTop = 0;
if (!!editorName) this.getAttachmentTextData();
//}.bind(this) );
o2.defer(this.resetNodeSize, 500, this);
}.bind(this) );
......@@ -2979,7 +2984,6 @@ debugger;
}.bind(this));
}
},
_loadEvents: function(editorConfig){
Object.each(this.json.events, function(e, key){
if (e.code){
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册