mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-08-04 13:43:23 +00:00
feature(view,edit,console,menu) add Loading check
This commit is contained in:
parent
acfc827555
commit
8f294504e1
4 changed files with 144 additions and 123 deletions
|
|
@ -6,6 +6,7 @@ var CloudCmd, Util, DOM, JsDiff, ace;
|
|||
|
||||
function EditProto(CloudCmd, Util, DOM){
|
||||
var Name = 'Edit',
|
||||
Loading = false,
|
||||
DIR = CloudCmd.LIBDIRCLIENT + 'edit/',
|
||||
Value,
|
||||
Edit = this,
|
||||
|
|
@ -18,6 +19,7 @@ var CloudCmd, Util, DOM, JsDiff, ace;
|
|||
this.init = function(pCallBack) {
|
||||
var lFunc, lIsFunc = Util.isFunction(CloudCmd.View);
|
||||
|
||||
Loading = true;
|
||||
if (lIsFunc)
|
||||
lFunc = CloudCmd.View;
|
||||
else
|
||||
|
|
@ -40,43 +42,45 @@ var CloudCmd, Util, DOM, JsDiff, ace;
|
|||
lExt = Util.getExtension(lName),
|
||||
lUseWorker = Util.strCmp(lExt, ['.js', '.json']);
|
||||
|
||||
Images.showLoad();
|
||||
|
||||
if (!Element) {
|
||||
Element = DOM.anyload({
|
||||
name : 'div',
|
||||
className : 'edit',
|
||||
style :
|
||||
'width : 100%;' +
|
||||
'height : 100%;' +
|
||||
'font : 16px "Droid Sans Mono";' +
|
||||
'position: absolute;',
|
||||
not_append : true
|
||||
});
|
||||
|
||||
initAce();
|
||||
}
|
||||
|
||||
Ace.session.setOption('useWorker', lUseWorker);
|
||||
|
||||
if ( Util.isString(pValue) ) {
|
||||
Ace.setValue(pValue);
|
||||
CloudCmd.View.show(Element, focus);
|
||||
Key.unsetBind();
|
||||
}
|
||||
else {
|
||||
DOM.getCurrentData({
|
||||
success : function(pData){
|
||||
var lValue = '';
|
||||
|
||||
if (pData)
|
||||
lValue = pData.data;
|
||||
|
||||
Value = lValue;
|
||||
Ace.setValue(lValue);
|
||||
CloudCmd.View.show(Element, focus);
|
||||
}
|
||||
});
|
||||
if (!Loading) {
|
||||
Images.showLoad();
|
||||
|
||||
if (!Element) {
|
||||
Element = DOM.anyload({
|
||||
name : 'div',
|
||||
className : 'edit',
|
||||
style :
|
||||
'width : 100%;' +
|
||||
'height : 100%;' +
|
||||
'font : 16px "Droid Sans Mono";' +
|
||||
'position: absolute;',
|
||||
not_append : true
|
||||
});
|
||||
|
||||
initAce();
|
||||
}
|
||||
|
||||
Ace.session.setOption('useWorker', lUseWorker);
|
||||
|
||||
if ( Util.isString(pValue) ) {
|
||||
Ace.setValue(pValue);
|
||||
CloudCmd.View.show(Element, focus);
|
||||
Key.unsetBind();
|
||||
}
|
||||
else {
|
||||
DOM.getCurrentData({
|
||||
success : function(pData){
|
||||
var lValue = '';
|
||||
|
||||
if (pData)
|
||||
lValue = pData.data;
|
||||
|
||||
Value = lValue;
|
||||
Ace.setValue(lValue);
|
||||
CloudCmd.View.show(Element, focus);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -132,7 +136,7 @@ var CloudCmd, Util, DOM, JsDiff, ace;
|
|||
|
||||
DOM.anyLoadOnLoad(lFiles, function(){
|
||||
Util.timeEnd(Name + ' load');
|
||||
|
||||
Loading = false;
|
||||
Util.exec(pCallBack);
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue