feature(edit) add get data from storage before diff

This commit is contained in:
coderaiser 2013-12-02 10:38:07 +00:00
parent 0dc0b3e74a
commit b21910f2eb

View file

@ -189,21 +189,28 @@ var CloudCmd, Util, DOM, CloudFunc, ace, DiffProto, diff_match_patch;
}
function diff(pNewValue, pCallBack) {
var libs = [
var libs = [
LIBDIR + 'diff.js',
LIBDIR + 'diff/diff-match-patch.js'
],
url = CloudFunc.getCombineURL(libs);
url = CloudFunc.getCombineURL(libs);
DOM.jsload(url, function() {
var patch;
var patch,
isAllowed = DOM.Storage.isAllowed();
if (!Diff)
Diff = new DiffProto(diff_match_patch);
Diff = new DiffProto(diff_match_patch);
patch = Diff.createPatch(Value, pNewValue);
Util.exec(pCallBack, patch);
Util.ifExec(!isAllowed, function() {
patch = Diff.createPatch(Value, pNewValue);
Util.exec(pCallBack, patch);
}, function(callback) {
DOM.getCurrentData(function(data) {
Value = data.data;
callback();
});
});
});
}