mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 10:45:47 +00:00
fix(edit) setValueFirst before edward loaded
This commit is contained in:
parent
5441ac8470
commit
4b712c95c6
1 changed files with 26 additions and 23 deletions
|
|
@ -33,7 +33,9 @@ var CloudCmd, Util, DOM, CloudFunc, MenuIO, Format, edward;
|
|||
};
|
||||
|
||||
function init(callback) {
|
||||
var element = createElement();
|
||||
var element;
|
||||
|
||||
element = createElement();
|
||||
|
||||
element.addEventListener('contextmenu', setMenu);
|
||||
|
||||
|
|
@ -65,30 +67,32 @@ var CloudCmd, Util, DOM, CloudFunc, MenuIO, Format, edward;
|
|||
}
|
||||
|
||||
this.show = function(callback) {
|
||||
Images.show.load();
|
||||
|
||||
if (callback)
|
||||
ConfigView.beforeShow = callback;
|
||||
|
||||
Info.getData(function(error, data) {
|
||||
var path = Info.path,
|
||||
isDir = Info.isDir,
|
||||
name = Info.name;
|
||||
if (!Loading) {
|
||||
Images.show.load();
|
||||
|
||||
if (isDir)
|
||||
name += '.json';
|
||||
if (callback)
|
||||
ConfigView.beforeShow = callback;
|
||||
|
||||
if (error) {
|
||||
alert(error);
|
||||
} else {
|
||||
edward.setValueFirst(path, data);
|
||||
Info.getData(function(error, data) {
|
||||
var path = Info.path,
|
||||
isDir = Info.isDir,
|
||||
name = Info.name;
|
||||
|
||||
setMsgChanged(name);
|
||||
edward.setModeForPath(name);
|
||||
if (isDir)
|
||||
name += '.json';
|
||||
|
||||
CloudCmd.View.show(Element, ConfigView);
|
||||
}
|
||||
});
|
||||
if (error) {
|
||||
alert(error);
|
||||
} else {
|
||||
edward.setValueFirst(path, data);
|
||||
|
||||
setMsgChanged(name);
|
||||
edward.setModeForPath(name);
|
||||
|
||||
CloudCmd.View.show(Element, ConfigView);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
|
|
@ -137,12 +141,11 @@ var CloudCmd, Util, DOM, CloudFunc, MenuIO, Format, edward;
|
|||
maxSize : CloudFunc.MAX_FILE_SIZE
|
||||
};
|
||||
|
||||
Loading = false;
|
||||
|
||||
edward = window[Editor];
|
||||
|
||||
edward(element, options, function() {
|
||||
Util.timeEnd(Name + ' load');
|
||||
Loading = false;
|
||||
exec(callback);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue