mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-21 02:29:23 +00:00
feature(edit) add get data from storage before diff
This commit is contained in:
parent
0dc0b3e74a
commit
b21910f2eb
1 changed files with 14 additions and 7 deletions
|
|
@ -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();
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue