mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Don't un-comment code with alt+. in the query tool. It's only supposed to respond to ctrl/cmd+. Fixes #2769
This commit is contained in:
committed by
Dave Page
parent
d02a0de8c9
commit
937984f2dc
@@ -23,16 +23,22 @@ function keyboardShortcuts(sqlEditorController, queryToolActions, event) {
|
||||
} else if (keyCode === F8_KEY) {
|
||||
event.preventDefault();
|
||||
queryToolActions.download(sqlEditorController);
|
||||
} else if (((this.isMac() && event.metaKey) || (!this.isMac() && event.ctrlKey)) &&
|
||||
event.shiftKey && keyCode === FWD_SLASH_KEY) {
|
||||
} else if ((
|
||||
(this.isMac() && event.metaKey) ||
|
||||
(!this.isMac() && event.ctrlKey)
|
||||
) && !event.altKey && event.shiftKey && keyCode === FWD_SLASH_KEY) {
|
||||
_stopEventPropagation();
|
||||
queryToolActions.commentBlockCode(sqlEditorController);
|
||||
} else if (((this.isMac() && event.metaKey) || (!this.isMac() && event.ctrlKey)) &&
|
||||
keyCode === FWD_SLASH_KEY) {
|
||||
} else if ((
|
||||
(this.isMac() && !this.isKeyCtrlAltShift(event) && event.metaKey) ||
|
||||
(!this.isMac() && !this.isKeyAltShift(event) && event.ctrlKey)
|
||||
) && keyCode === FWD_SLASH_KEY) {
|
||||
_stopEventPropagation();
|
||||
queryToolActions.commentLineCode(sqlEditorController);
|
||||
} else if (((this.isMac() && event.metaKey) || (!this.isMac() && event.ctrlKey)) &&
|
||||
keyCode === PERIOD_KEY) {
|
||||
} else if ((
|
||||
(this.isMac() && !this.isKeyCtrlAltShift(event) && event.metaKey) ||
|
||||
(!this.isMac() && !this.isKeyAltShift(event) && event.ctrlKey)
|
||||
) && keyCode === PERIOD_KEY) {
|
||||
_stopEventPropagation();
|
||||
queryToolActions.uncommentLineCode(sqlEditorController);
|
||||
}
|
||||
@@ -49,7 +55,27 @@ function isMac() {
|
||||
return window.navigator.platform.search('Mac') != -1;
|
||||
}
|
||||
|
||||
function isKeyCtrlAlt(event) {
|
||||
return event.ctrlKey || event.altKey;
|
||||
}
|
||||
|
||||
function isKeyAltShift(event) {
|
||||
return event.altKey || event.shiftKey;
|
||||
}
|
||||
|
||||
function isKeyCtrlShift(event) {
|
||||
return event.ctrlKey || event.shiftKey;
|
||||
}
|
||||
|
||||
function isKeyCtrlAltShift(event) {
|
||||
return event.ctrlKey || event.altKey || event.shiftKey;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
processEvent: keyboardShortcuts,
|
||||
isMac: isMac,
|
||||
isKeyCtrlAlt: isKeyCtrlAlt,
|
||||
isKeyAltShift: isKeyAltShift,
|
||||
isKeyCtrlShift: isKeyCtrlShift,
|
||||
isKeyCtrlAltShift: isKeyCtrlAltShift
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user