mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-25 17:04:16 +00:00
refactor(edit) add callFocus
This commit is contained in:
parent
3b6d977e5a
commit
13681b279b
1 changed files with 14 additions and 10 deletions
|
|
@ -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
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue