From 1e1a9f2cf4a76a4761bad780317b0908a565ee00 Mon Sep 17 00:00:00 2001 From: Dave Page Date: Wed, 19 Jul 2017 11:43:45 +0100 Subject: [PATCH] Add controls and shortcuts for commenting/uncommenting code in the SQL Editor. Fixes #2456. Take the opportunity to tidy up the menus and add access keys to appropriate buttons. --- docs/en_US/keyboard_shortcuts.rst | 6 + web/pgadmin/static/bundle/codemirror.js | 1 + .../datagrid/templates/datagrid/index.html | 65 +++++--- .../templates/sqleditor/js/sqleditor.js | 152 +++++++++++++++++- 4 files changed, 204 insertions(+), 20 deletions(-) diff --git a/docs/en_US/keyboard_shortcuts.rst b/docs/en_US/keyboard_shortcuts.rst index 2194d63bc..cd0938d57 100644 --- a/docs/en_US/keyboard_shortcuts.rst +++ b/docs/en_US/keyboard_shortcuts.rst @@ -41,6 +41,12 @@ 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+. | Ctrl+Shift+. | Uncomment selected code (Inline) | ++--------------------------+------------------+-------------------------------------+ +| Ctrl+Shift+/ | Ctrl+Shift+/ | Comment/Uncomment code (Block) | ++--------------------------+------------------+-------------------------------------+ | Ctrl+A | Cmd+A | Select all | +--------------------------+------------------+-------------------------------------+ | Ctrl+C | Cmd+C | Copy selected text to the clipboard | diff --git a/web/pgadmin/static/bundle/codemirror.js b/web/pgadmin/static/bundle/codemirror.js index 6c3525b13..c8766ff13 100644 --- a/web/pgadmin/static/bundle/codemirror.js +++ b/web/pgadmin/static/bundle/codemirror.js @@ -13,6 +13,7 @@ import 'codemirror/addon/search/searchcursor'; import 'codemirror/addon/search/jump-to-line'; import 'codemirror/addon/edit/matchbrackets'; import 'codemirror/addon/edit/closebrackets'; +import 'codemirror/addon/comment/comment' import 'pgadmin.sqlfoldcode'; export default CodeMirror; \ No newline at end of file diff --git a/web/pgadmin/tools/datagrid/templates/datagrid/index.html b/web/pgadmin/tools/datagrid/templates/datagrid/index.html index 24ea7420f..cb700523c 100644 --- a/web/pgadmin/tools/datagrid/templates/datagrid/index.html +++ b/web/pgadmin/tools/datagrid/templates/datagrid/index.html @@ -24,14 +24,14 @@