Fix more of the funky keyboard shortcuts.

This commit is contained in:
Surinder Kumar 2016-08-08 15:26:37 +01:00 committed by Dave Page
parent 37ca3579f3
commit 1bcac0b67c
5 changed files with 45 additions and 7 deletions

View File

@ -320,7 +320,8 @@ function(require, $, _, S, Bootstrap, pgAdmin, alertify, CodeMirror) {
lineNumbers: true,
lineWrapping: true,
mode: "text/x-pgsql",
readOnly: true
readOnly: true,
extraKeys: pgAdmin.Browser.editor_shortcut_keys
});
setTimeout(function() {
@ -708,6 +709,38 @@ function(require, $, _, S, Bootstrap, pgAdmin, alertify, CodeMirror) {
});
return preference;
},
editor_shortcut_keys: {
// Autocomplete sql command
"Ctrl-Space": "autocomplete",
"Cmd-Space": "autocomplete",
// Select All text
"Ctrl-A": "selectAll",
"Cmd-A": "selectAll",
// Redo text
"Ctrl-Y": "redo",
"Cmd-Y": "redo",
// Undo text
"Ctrl-Z": "undo",
"Cmd-Z": "undo",
// Delete Line
"Ctrl-D": "deleteLine",
"Cmd-D": "deleteLine",
// Go to start/end of Line
"Alt-Left": "goLineStart",
"Alt-Right": "goLineEnd",
// Move word by word left/right
"Ctrl-Alt-Left": "goGroupLeft",
"Cmd-Alt-Left": "goGroupLeft",
"Ctrl-Alt-Right": "goGroupRight"
"Cmd-Alt-Right": "goGroupRight"
}
});

View File

@ -1392,7 +1392,8 @@
lineNumbers: true,
lineWrapping: true,
mode: "text/x-pgsql",
readOnly: true
readOnly: true,
extraKeys: pgAdmin.Browser.editor_shortcut_keys
});
return this;
@ -2118,7 +2119,8 @@
(self.$el.find("textarea")[0]), {
lineNumbers: true,
mode: "text/x-sql",
readOnly: isDisabled
readOnly: isDisabled,
extraKeys: pgAdmin.Browser.editor_shortcut_keys
});
if (!isVisible)

View File

@ -243,7 +243,8 @@ define(
lineWrapping: true,
matchBrackets: true,
indentUnit: 4,
mode: "text/x-pgsql"
mode: "text/x-pgsql",
extraKeys: pgBrowser.editor_shortcut_keys
});
},

View File

@ -1422,7 +1422,8 @@ define(
},
gutters: ["CodeMirror-linenumbers", "CodeMirror-foldgutter", "breakpoints"],
mode: "text/x-pgsql",
readOnly: true
readOnly: true,
extraKeys: pgAdmin.Browser.editor_shortcut_keys
});
// On loading the docker, register the callbacks

View File

@ -206,7 +206,8 @@ define(
rangeFinder: CodeMirror.fold.combine(CodeMirror.pgadminBeginRangeFinder, CodeMirror.pgadminIfRangeFinder,
CodeMirror.pgadminLoopRangeFinder, CodeMirror.pgadminCaseRangeFinder)
},
gutters: ["CodeMirror-linenumbers", "CodeMirror-foldgutter"]
gutters: ["CodeMirror-linenumbers", "CodeMirror-foldgutter"],
extraKeys: pgBrowser.editor_shortcut_keys
});
// Create main wcDocker instance
@ -248,7 +249,7 @@ define(
CodeMirror.pgadminLoopRangeFinder, CodeMirror.pgadminCaseRangeFinder)
},
gutters: ["CodeMirror-linenumbers", "CodeMirror-foldgutter"],
extraKeys: {"Ctrl-Space": "autocomplete"}
extraKeys: pgBrowser.editor_shortcut_keys
});
// Create panels for 'Data Output', 'Explain', 'Messages' and 'History'