Function: Created key_press function to dynamically generate key detection javascript.

Voicemail: Ctrl+A checks all checkboxes, pressing Delete deletes the checked Voicemails.
Editor: Integrated key_press function.
Command: Integrated key_press function.
This commit is contained in:
reliberate
2016-03-31 17:11:37 -06:00
parent a4005f46e3
commit 9cfedbf2e9
7 changed files with 196 additions and 167 deletions

View File

@@ -273,28 +273,14 @@ else {
document.getElementById('editor').style.fontSize='<?php echo $setting_size;?>';
focus_editor();
//prevent submit (file save) with enter key on file path input
$('#current_file').keypress(function(event){
if (event.which == 13) { return false; }
});
//prevent form submit with enter key on file path input
<?php key_press('enter', 'down', '#current_file', null, null, 'return false;', false); ?>
//keyboard shortcut to save file
$(window).keypress(function(event) {
//save file [Ctrl+S]
if ((event.which == 115 && event.ctrlKey) || (event.which == 19)) {
$('form#frm_edit').submit();
return false;
}
//open file manager/clip library pane [Ctrl+Q]
else if ((event.which == 113 && event.ctrlKey) || (event.which == 19)) {
toggle_sidebar();
return false;
}
//otherwise, default action
else {
return true;
}
});
//save file
<?php key_press('ctrl+s', 'down', 'window', null, null, "$('form#frm_edit').submit(); return false;", false); ?>
//open file manager/clip library pane
<?php key_press('ctrl+q', 'down', 'window', null, null, 'toggle_sidebar(); focus_editor(); return false;', false); ?>
//remove certain keyboard shortcuts
editor.commands.bindKey("Ctrl-T", null); //new browser tab