mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-21 02:29:23 +00:00
feature(edit) rm client sha
This commit is contained in:
parent
c94515d0a2
commit
1b47867f9c
5 changed files with 18 additions and 389 deletions
|
|
@ -12,7 +12,6 @@ var CloudCmd, Util, DOM, CloudFunc, ace, DiffProto, diff_match_patch;
|
|||
Value,
|
||||
Edit = this,
|
||||
Diff,
|
||||
SHA,
|
||||
Ace,
|
||||
Msg,
|
||||
Dialog = DOM.Dialog,
|
||||
|
|
@ -161,20 +160,12 @@ var CloudCmd, Util, DOM, CloudFunc, ace, DiffProto, diff_match_patch;
|
|||
}
|
||||
|
||||
DOM.checkStorageHash(lPath, function(error, equal) {
|
||||
var ret,
|
||||
msg = 'File is changed, overwrite?',
|
||||
saveFunc = function(text) {
|
||||
var hash = SHA.digest(Value);
|
||||
onSave(text, hash);
|
||||
};
|
||||
|
||||
if (!error && !equal)
|
||||
ret = Dialog.confirm(msg);
|
||||
else
|
||||
DOM.RESTful.save(lPath, lValue, saveFunc, query);
|
||||
if (!error) {
|
||||
if (!equal)
|
||||
query = '';
|
||||
|
||||
if (ret)
|
||||
DOM.RESTful.save(lPath, lValue, saveFunc);
|
||||
DOM.RESTful.save(lPath, lValue, onSave, query);
|
||||
}
|
||||
});
|
||||
|
||||
}, function(callback) {
|
||||
|
|
@ -188,16 +179,12 @@ var CloudCmd, Util, DOM, CloudFunc, ace, DiffProto, diff_match_patch;
|
|||
function diff(pNewValue, pCallBack) {
|
||||
var libs = [
|
||||
LIBDIR + 'diff.js',
|
||||
LIBDIR + 'diff/diff-match-patch.js',
|
||||
LIBDIR + 'sha1/rusha.js'
|
||||
LIBDIR + 'diff/diff-match-patch.js'
|
||||
];
|
||||
|
||||
DOM.anyLoadInParallel(libs, function() {
|
||||
var patch;
|
||||
|
||||
if (!SHA)
|
||||
SHA = new Rusha();
|
||||
|
||||
if (!Diff)
|
||||
Diff = new DiffProto(diff_match_patch);
|
||||
|
||||
|
|
@ -243,7 +230,7 @@ var CloudCmd, Util, DOM, CloudFunc, ace, DiffProto, diff_match_patch;
|
|||
|
||||
if (!isError) {
|
||||
Edit.showMessage(text);
|
||||
DOM.saveDataToStorage(path, Value, hash);
|
||||
DOM.saveDataToStorage(path, Value);
|
||||
} else {
|
||||
ret = Dialog.confirm(text + msg);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue