feature(console) add clear with Ctrl + l

This commit is contained in:
coderaiser 2014-07-09 05:20:38 -04:00
parent 848dac0df1
commit 4730a2056e
2 changed files with 24 additions and 10 deletions

View file

@ -155,6 +155,7 @@ Console
| `~` | open
| `Ctrl + p` | paste path of current directory
| `Ctrl + z` | cancel current prompt
| `Ctrl + l` | clear
| `Esc` | close
Config

View file

@ -45,6 +45,7 @@ var CloudCmd, Util, DOM, CloudFunc, $;
}
this.show = show;
this.clear = clear;
// Handle a command.
function handler(command) {
@ -66,16 +67,7 @@ var CloudCmd, Util, DOM, CloudFunc, $;
jqconsole = $(Element).jqconsole('', '> ');
jqconsole.RegisterShortcut('Z', function() {
jqconsole.SetPromptText('');
});
jqconsole.RegisterShortcut('P', function() {
var command = jqconsole.GetPromptText();
command += DOM.getCurrentDirPath();
jqconsole.SetPromptText(command);
});
addShortCuts(jqconsole);
}
CloudCmd.View.show(Element, {
@ -131,6 +123,27 @@ var CloudCmd, Util, DOM, CloudFunc, $;
}
}
function addShortCuts(jqconsole) {
jqconsole.RegisterShortcut('Z', function() {
jqconsole.SetPromptText('');
});
jqconsole.RegisterShortcut('L', clear);
jqconsole.RegisterShortcut('P', function() {
var command = jqconsole.GetPromptText();
command += DOM.getCurrentDirPath();
jqconsole.SetPromptText(command);
});
}
function clear() {
jqconsole.Reset();
addShortCuts(jqconsole);
jqconsole.Prompt(true, handler);
}
function load(callback) {
var dir = CloudCmd.LIBDIRCLIENT + 'console/',
jsPath = dir + 'lib/',