diff --git a/docs/en_US/keyboard_shortcuts.rst b/docs/en_US/keyboard_shortcuts.rst
index cd0938d..32f06f0 100644
--- a/docs/en_US/keyboard_shortcuts.rst
+++ b/docs/en_US/keyboard_shortcuts.rst
@@ -41,11 +41,11 @@ When using the syntax-highlighting SQL editors, the following shortcuts are avai
+--------------------------+------------------+-------------------------------------+
| Ctrl+Alt+Right | Cmd+Option+Right | Move right one word |
+--------------------------+------------------+-------------------------------------+
-| Ctrl+Shift+, | Ctrl+Shift+, | Comment selected code (Inline) |
+| Ctrl+Shift+/ | Cmd+Shift+/ | Comment selected code (Inline) |
+--------------------------+------------------+-------------------------------------+
-| Ctrl+Shift+. | Ctrl+Shift+. | Uncomment selected code (Inline) |
+| Ctrl+Shift+. | Cmd+Shift+. | Uncomment selected code (Inline) |
+--------------------------+------------------+-------------------------------------+
-| Ctrl+Shift+/ | Ctrl+Shift+/ | Comment/Uncomment code (Block) |
+| Ctrl+/ | Cmd+/ | Comment/Uncomment code (Block) |
+--------------------------+------------------+-------------------------------------+
| Ctrl+A | Cmd+A | Select all |
+--------------------------+------------------+-------------------------------------+
diff --git a/web/pgadmin/static/js/sqleditor/keyboard_shortcuts.js b/web/pgadmin/static/js/sqleditor/keyboard_shortcuts.js
index c117413..5d947d1 100644
--- a/web/pgadmin/static/js/sqleditor/keyboard_shortcuts.js
+++ b/web/pgadmin/static/js/sqleditor/keyboard_shortcuts.js
@@ -1,9 +1,9 @@
const F5_KEY = 116,
F7_KEY = 118,
F8_KEY = 119,
- COMMA_KEY = 188,
PERIOD_KEY = 190,
- FWD_SLASH_KEY = 191;
+ FWD_SLASH_KEY = 191,
+ IS_CMD_KEY = window.navigator.platform.search('Mac') != -1;
function keyboardShortcuts(sqlEditorController, event) {
if (sqlEditorController.isQueryRunning()) {
@@ -24,13 +24,16 @@ function keyboardShortcuts(sqlEditorController, event) {
} else if (keyCode === F8_KEY) {
event.preventDefault();
sqlEditorController.download();
- } else if (event.shiftKey && event.ctrlKey && keyCode === COMMA_KEY) {
+ } else if (((IS_CMD_KEY && event.metaKey) || (!IS_CMD_KEY && event.ctrlKey)) &&
+ event.shiftKey && keyCode === FWD_SLASH_KEY) {
_stopEventPropagation();
sqlEditorController.commentLineCode();
- } else if (event.shiftKey && event.ctrlKey && keyCode === PERIOD_KEY) {
+ } else if (((IS_CMD_KEY && event.metaKey) || (!IS_CMD_KEY && event.ctrlKey)) &&
+ event.shiftKey && keyCode === PERIOD_KEY) {
_stopEventPropagation();
sqlEditorController.uncommentLineCode();
- } else if (event.shiftKey && event.ctrlKey && keyCode === FWD_SLASH_KEY) {
+ } else if (((IS_CMD_KEY && event.metaKey) || (!IS_CMD_KEY && event.ctrlKey)) &&
+ keyCode === FWD_SLASH_KEY) {
_stopEventPropagation();
sqlEditorController.commentBlockCode();
}
diff --git a/web/pgadmin/tools/datagrid/__init__.py b/web/pgadmin/tools/datagrid/__init__.py
index 08b01ab..d3a4a9d 100644
--- a/web/pgadmin/tools/datagrid/__init__.py
+++ b/web/pgadmin/tools/datagrid/__init__.py
@@ -15,6 +15,7 @@ import pickle
import random
from flask import Response, url_for, session, request, make_response
+from werkzeug.useragents import UserAgent
from flask import current_app as app
from flask_babel import gettext
from flask_security import login_required
@@ -183,6 +184,9 @@ def panel(trans_id, is_query_tool, editor_title):
else:
sURL = None
+ # We need client OS information to render correct Keyboard shortcuts
+ user_agent = UserAgent(request.headers.get('User-Agent'))
+
"""
Animations and transitions are not automatically GPU accelerated and by default use browser's slow rendering engine.
We need to set 'translate3d' value of '-webkit-transform' property in order to use GPU.
@@ -212,7 +216,8 @@ def panel(trans_id, is_query_tool, editor_title):
editor_title=editor_title, script_type_url=sURL,
is_desktop_mode=app.PGADMIN_RUNTIME,
is_linux=is_linux_platform,
- is_new_browser_tab=new_browser_tab
+ is_new_browser_tab=new_browser_tab,
+ client_plaform=user_agent.platform
)
diff --git a/web/pgadmin/tools/datagrid/templates/datagrid/index.html b/web/pgadmin/tools/datagrid/templates/datagrid/index.html
index fa6f750..937ae87 100644
--- a/web/pgadmin/tools/datagrid/templates/datagrid/index.html
+++ b/web/pgadmin/tools/datagrid/templates/datagrid/index.html
@@ -127,13 +127,22 @@
{{ _('Unindent Selection (Shift+Tab)') }}