refactor(edit) add callFocus

This commit is contained in:
coderaiser 2014-05-16 03:32:53 -04:00
parent 3b6d977e5a
commit 13681b279b

View file

@ -38,11 +38,10 @@ var CloudCmd, Util, DOM, CloudFunc, ace, DiffProto, diff_match_patch, Zip, MenuI
isStr = Util.isString(value),
name = Info.name,
isDir = Info.isDir,
focus = function() {
Ace.focus();
focus = Util.bind(callFocus, function() {
Ace.clearSelection();
Ace.moveCursorTo(0, 0);
};
});
if (!Loading) {
Images.showLoad();
@ -130,6 +129,11 @@ var CloudCmd, Util, DOM, CloudFunc, ace, DiffProto, diff_match_patch, Zip, MenuI
Ace.gotoLine(number);
};
function callFocus(callback) {
Util.exec(callback);
Ace.focus();
}
function isChanged() {
var is,
value = Ace.getValue(),
@ -381,15 +385,15 @@ var CloudCmd, Util, DOM, CloudFunc, ace, DiffProto, diff_match_patch, Zip, MenuI
Menu = new MenuIO(element, options, {
'Save Ctrl+S' : save,
'Go To Line Ctrl+G' : Edit.goToLine,
'Select All Ctrl+A' : function() {
'Go To Line Ctrl+G' : Util.bind(callFocus, function() {
Edit.goToLine();
}),
'Select All Ctrl+A' : Util.bind(callFocus, function() {
Ace.selectAll();
Ace.focus();
},
'Delete Del' : function() {
}),
'Delete Del' : Util.bind(callFocus, function() {
Ace.remove('right');
Ace.focus();
},
}),
'Close Esc' : Edit.hide
});
});