mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-19 09:24:51 +00:00
feature(edit) save -> Edit.save
This commit is contained in:
parent
29341eb1ec
commit
47e0dbfdca
1 changed files with 22 additions and 8 deletions
|
|
@ -165,7 +165,7 @@ var CloudCmd, Util, DOM, CloudFunc, ace, DiffProto, diff_match_patch, Zip, MenuI
|
|||
is = Dialog.confirm(msg);
|
||||
|
||||
if (is)
|
||||
save();
|
||||
Edit.save();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -230,13 +230,17 @@ var CloudCmd, Util, DOM, CloudFunc, ace, DiffProto, diff_match_patch, Zip, MenuI
|
|||
Ace.commands.addCommand({
|
||||
name : 'save',
|
||||
bindKey : { win: 'Ctrl-S', mac: 'Command-S' },
|
||||
exec : save
|
||||
exec : function() {
|
||||
Edit.save();
|
||||
}
|
||||
});
|
||||
|
||||
Ace.commands.addCommand({
|
||||
name : 'saveMC',
|
||||
bindKey : { win: 'F2', mac: 'F2' },
|
||||
exec : save
|
||||
exec : function() {
|
||||
Edit.save();
|
||||
}
|
||||
});
|
||||
|
||||
Ace.commands.addCommand({
|
||||
|
|
@ -265,7 +269,7 @@ var CloudCmd, Util, DOM, CloudFunc, ace, DiffProto, diff_match_patch, Zip, MenuI
|
|||
});
|
||||
}
|
||||
|
||||
function save () {
|
||||
Edit.save = function() {
|
||||
var path = Info.path,
|
||||
value = Ace.getValue();
|
||||
|
||||
|
|
@ -289,9 +293,9 @@ var CloudCmd, Util, DOM, CloudFunc, ace, DiffProto, diff_match_patch, Zip, MenuI
|
|||
var result = data || Value;
|
||||
|
||||
if (isPatch)
|
||||
RESTful.patch(path, patch, onSave);
|
||||
Edit.save.patch(path, patch);
|
||||
else
|
||||
RESTful.write(path + query, result, onSave);
|
||||
Edit.save.write(path + query, result);
|
||||
}, function(func) {
|
||||
zip(value, function(error, data) {
|
||||
if (error)
|
||||
|
|
@ -304,7 +308,15 @@ var CloudCmd, Util, DOM, CloudFunc, ace, DiffProto, diff_match_patch, Zip, MenuI
|
|||
|
||||
}, exec.with(doDiff, path));
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
Edit.save.patch = function(path, patch) {
|
||||
RESTful.patch(path, patch, onSave);
|
||||
};
|
||||
|
||||
Edit.save.write = function(path, result) {
|
||||
RESTful.write(path, result, onSave);
|
||||
};
|
||||
|
||||
function doDiff(path, callback) {
|
||||
var value = Ace.getValue();
|
||||
|
|
@ -421,7 +433,9 @@ var CloudCmd, Util, DOM, CloudFunc, ace, DiffProto, diff_match_patch, Zip, MenuI
|
|||
}
|
||||
},
|
||||
menuData = {
|
||||
'Save Ctrl+S' : save,
|
||||
'Save Ctrl+S' : function() {
|
||||
Edit.save();
|
||||
},
|
||||
'Go To Line Ctrl+G' : function() {
|
||||
Edit.goToLine();
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue