mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-18 00:47:01 +00:00
fix(edit) diff: add error check
This commit is contained in:
parent
7788e6b0f7
commit
677eca4d7e
1 changed files with 18 additions and 14 deletions
|
|
@ -294,26 +294,30 @@ var CloudCmd, Util, DOM, CloudFunc, ace, DiffProto, diff_match_patch, Zip, MenuI
|
|||
],
|
||||
url = CloudFunc.getJoinURL(libs);
|
||||
|
||||
DOM.load.js(url, function() {
|
||||
DOM.load.js(url, function(error) {
|
||||
var patch,
|
||||
isAllowed = DOM.Storage.isAllowed();
|
||||
|
||||
if (!Diff)
|
||||
Diff = new DiffProto(diff_match_patch);
|
||||
|
||||
Util.exec.if(!isAllowed, function() {
|
||||
patch = Diff.createPatch(Value, newValue);
|
||||
Util.exec(callback, patch);
|
||||
}, function(func) {
|
||||
var path = Info.path;
|
||||
if (error) {
|
||||
DOM.Dialog.alert(error);
|
||||
} else {
|
||||
if (!Diff)
|
||||
Diff = new DiffProto(diff_match_patch);
|
||||
|
||||
DOM.getDataFromStorage(path, function(error, data) {
|
||||
if (data)
|
||||
Value = data;
|
||||
Util.exec.if(!isAllowed, function() {
|
||||
patch = Diff.createPatch(Value, newValue);
|
||||
Util.exec(callback, patch);
|
||||
}, function(func) {
|
||||
var path = Info.path;
|
||||
|
||||
func();
|
||||
DOM.getDataFromStorage(path, function(error, data) {
|
||||
if (data)
|
||||
Value = data;
|
||||
|
||||
func();
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue