fix(edit) setValueFirst before edward loaded

This commit is contained in:
coderaiser 2015-05-13 09:07:09 -04:00
parent 5441ac8470
commit 4b712c95c6

View file

@ -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);
});
});