feature(edit) add beautify

This commit is contained in:
coderaiser 2014-10-23 07:18:11 -04:00
parent 7c6d963b6e
commit 3ee321bbce
5 changed files with 38 additions and 10 deletions

View file

@ -239,6 +239,14 @@ var CloudCmd, Util, DOM, CloudFunc, ace, DiffProto, diff_match_patch, Zip, MenuI
exec : save
});
Ace.commands.addCommand({
name : 'beautify',
bindKey : { win: 'Ctrl-B', mac: 'Command-B' },
exec : function() {
Edit.beautify();
}
});
ace.require('ace/ext/language_tools');
Modelist = ace.require('ace/ext/modelist');
@ -400,6 +408,9 @@ var CloudCmd, Util, DOM, CloudFunc, ace, DiffProto, diff_match_patch, Zip, MenuI
'Delete Del' : function() {
Ace.remove('right');
},
'Beautify Ctrl+B' : function() {
Edit.beautify();
},
'Close Esc' : Edit.hide
};
@ -471,7 +482,15 @@ var CloudCmd, Util, DOM, CloudFunc, ace, DiffProto, diff_match_patch, Zip, MenuI
}
}
function onDrop(event) {
Edit.beautify = function() {
var path = Info.path;
RESTful.read(path + '?beautify', function(data) {
Ace.setValue(data);
});
};
function onDrop(event) {
var reader, files,
onLoad = function(event) {
var data = event.target.result;