mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-18 17:05:17 +00:00
refactor(edit) save: lValue -> value
This commit is contained in:
parent
7b2423fe3d
commit
b6cf544f24
1 changed files with 8 additions and 8 deletions
|
|
@ -167,8 +167,8 @@ var CloudCmd, Util, DOM, CloudFunc, ace, DiffProto, diff_match_patch;
|
|||
}
|
||||
|
||||
function save () {
|
||||
var lPath = Info.path,
|
||||
lValue = Ace.getValue();
|
||||
var path = Info.path,
|
||||
value = Ace.getValue();
|
||||
|
||||
CloudCmd.getConfig(function(config) {
|
||||
var isDiff = config.diff;
|
||||
|
|
@ -177,27 +177,27 @@ var CloudCmd, Util, DOM, CloudFunc, ace, DiffProto, diff_match_patch;
|
|||
var query,
|
||||
MAX_SIZE = CloudFunc.MAX_FILE_SIZE,
|
||||
|
||||
length = lValue.length,
|
||||
length = value.length,
|
||||
|
||||
isLength = length > MAX_SIZE,
|
||||
isAllowed = DOM.Storage.isAllowed();
|
||||
|
||||
Value = lValue;
|
||||
Value = value;
|
||||
|
||||
Util.ifExec(isLength && !isAllowed, function() {
|
||||
if (!query)
|
||||
query = '';
|
||||
|
||||
DOM.RESTful.write(lPath + query, lValue, onSave);
|
||||
DOM.RESTful.write(path + query, value, onSave);
|
||||
}, function(callback) {
|
||||
DOM.checkStorageHash(lPath, function(error, equal) {
|
||||
DOM.checkStorageHash(path, function(error, equal) {
|
||||
var isString = Util.isString(patch),
|
||||
patchLength = patch.length,
|
||||
lessLength = patchLength < length;
|
||||
|
||||
if (!error) {
|
||||
if (equal && isString && patchLength && lessLength) {
|
||||
lValue = patch;
|
||||
value = patch;
|
||||
query = '?patch';
|
||||
}
|
||||
|
||||
|
|
@ -207,7 +207,7 @@ var CloudCmd, Util, DOM, CloudFunc, ace, DiffProto, diff_match_patch;
|
|||
});
|
||||
|
||||
}, function(callback) {
|
||||
diff(lValue, callback);
|
||||
diff(value, callback);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue