mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-24 03:05:41 +00:00
fixed bug with showing couple spinners
fixed bug with showing loading spinner, when f4 key pressed couple times and CodeMirror not loaded fully.
This commit is contained in:
parent
14affd3d52
commit
e68d253ea1
1 changed files with 27 additions and 11 deletions
|
|
@ -5,6 +5,9 @@ var CloudCommander, CloudFunc, CodeMirror;
|
|||
CloudCommander.Editor = {};
|
||||
CloudCommander.Editor.CodeMirror = new CloudCommander.Util()
|
||||
|
||||
/* indicator says CodeMirror still loads */
|
||||
CloudCommander.Editor.CodeMirror.loading = false;
|
||||
|
||||
/* function loads CodeMirror js and css files */;
|
||||
CloudCommander.Editor.CodeMirror.load = (function(pParent){
|
||||
/* function shows editor */
|
||||
|
|
@ -63,9 +66,15 @@ CloudCommander.Editor.CodeMirror.load = (function(pParent){
|
|||
CloudCommander.Editor.CodeMirror.show = (function(){
|
||||
/* if CloudEditor is not loaded - loading him */
|
||||
if(!this.getById('CloudEditor'))
|
||||
return this.load(this);
|
||||
/* removing keyBinding if set */
|
||||
return this.load(this);
|
||||
|
||||
/* if CodeMirror function show already
|
||||
* called do not call it again
|
||||
* if f4 key pressed couple times
|
||||
*/
|
||||
if(this.loading)
|
||||
return;
|
||||
|
||||
var lParent = this;
|
||||
var initCodeMirror_f = function(pValue){
|
||||
CodeMirror(lCloudEditor,{
|
||||
|
|
@ -121,26 +130,30 @@ CloudCommander.Editor.CodeMirror.show = (function(){
|
|||
}
|
||||
|
||||
/* показываем гиф загрузки возле пути папки сверху*/
|
||||
var lLoadingImage = CloudCommander._images.loading();
|
||||
var lErrorImage = CloudCommander._images.error();
|
||||
var lLoadingImage = CloudCommander._images.loading();
|
||||
var lErrorImage = CloudCommander._images.error();
|
||||
|
||||
lLoadingImage.className='icon loading';/* показываем загрузку*/
|
||||
lErrorImage.className='icon error hidden';/* прячем ошибку */
|
||||
lLoadingImage.className = 'icon loading';/* показываем загрузку*/
|
||||
lErrorImage.className = 'icon error hidden';/* прячем ошибку */
|
||||
/* show loading icon */
|
||||
lCurrent.firstChild.nextSibling.appendChild(lLoadingImage);
|
||||
|
||||
this.loading = true;
|
||||
var lParent = this;
|
||||
/* reading data from current file */
|
||||
$.ajax({
|
||||
url:lA,
|
||||
error: function(jqXHR, textStatus, errorThrown){
|
||||
lErrorImage.className ='icon error';
|
||||
lErrorImage.className = 'icon error';
|
||||
lErrorImage.title = jqXHR.responseText;
|
||||
|
||||
lCurrent.firstChild.nextSibling.appendChild(lErrorImage);
|
||||
|
||||
lLoadingImage.className ='hidden';
|
||||
lLoadingImage.className = 'hidden';
|
||||
|
||||
console.log(jqXHR.responseText);
|
||||
|
||||
lParent.loading = false;
|
||||
},
|
||||
|
||||
success:function(data, textStatus, jqXHR){
|
||||
|
|
@ -150,12 +163,15 @@ CloudCommander.Editor.CodeMirror.show = (function(){
|
|||
|
||||
initCodeMirror_f(data);
|
||||
|
||||
CloudCommander.keyBinded = false;
|
||||
/* removing keyBinding if set */
|
||||
CloudCommander.keyBinded = false;
|
||||
|
||||
lLeft &&
|
||||
(lLeft.className = 'panel hidden');
|
||||
(lLeft.className = 'panel hidden');
|
||||
|
||||
lLoadingImage.className ='hidden';
|
||||
lLoadingImage.className = 'hidden';
|
||||
|
||||
lParent.loading = false;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue