mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2026-10-25 22:20:05 -05:00
Added SQL Formatter support in Query Tool. Fixes #2042
This commit is contained in:
1 parent
cc5a7ea334
commit
79e6480513
12 files changed
+460
-212
No files matched your search
@@ -17,7 +17,8 @@ const PERIOD_KEY = 190,
|
||||
LEFT_KEY = 37,
|
||||
UP_KEY = 38,
|
||||
RIGHT_KEY = 39,
|
||||
DOWN_KEY = 40;
|
||||
DOWN_KEY = 40,
|
||||
K_KEY = 75;
|
||||
|
||||
function isMac() {
|
||||
return window.navigator.platform.search('Mac') != -1;
|
||||
@@ -247,6 +248,12 @@ function keyboardShortcutsQueryTool(
|
||||
) && keyCode === PERIOD_KEY) {
|
||||
this._stopEventPropagation(event);
|
||||
queryToolActions.uncommentLineCode(sqlEditorController);
|
||||
} else if ((
|
||||
(this.isMac() && event.metaKey) ||
|
||||
(!this.isMac() && event.ctrlKey)
|
||||
) && !event.altKey && event.shiftKey && keyCode === K_KEY) {
|
||||
this._stopEventPropagation(event);
|
||||
queryToolActions.formatSql(sqlEditorController);
|
||||
} else if (keyCode == ESC_KEY) {
|
||||
queryToolActions.focusOut(sqlEditorController);
|
||||
/*Apply only for sub-dropdown*/
|
||||
|
||||
@@ -123,6 +123,10 @@ let queryToolActions = {
|
||||
);
|
||||
},
|
||||
|
||||
formatSql: function (sqlEditorController) {
|
||||
sqlEditorController.gridView.on_format_sql();
|
||||
},
|
||||
|
||||
focusOut: function () {
|
||||
document.activeElement.blur();
|
||||
pgWindow.document.activeElement.blur();
|
||||
|
||||
Reference in new issue
Block a user