From 394381bf754679c42c5e5f39e6ff8e7b2d7ed5fd Mon Sep 17 00:00:00 2001 From: Dave Page Date: Thu, 24 Nov 2016 15:38:30 +0000 Subject: [PATCH] Add search/replace support to the Query Tool, including regexp matching. Fixes #1765 --- docs/en_US/keyboard_shortcuts.rst | 38 ++++++---- web/pgadmin/browser/__init__.py | 1 + web/pgadmin/static/css/overrides.css | 18 ++++- .../datagrid/templates/datagrid/index.html | 48 ++++++++++++ .../templates/sqleditor/js/sqleditor.js | 75 +++++++++++++++++++ 5 files changed, 166 insertions(+), 14 deletions(-) diff --git a/docs/en_US/keyboard_shortcuts.rst b/docs/en_US/keyboard_shortcuts.rst index dac3319ec..dd422247a 100644 --- a/docs/en_US/keyboard_shortcuts.rst +++ b/docs/en_US/keyboard_shortcuts.rst @@ -58,16 +58,28 @@ When using the syntax-highlighting SQL editors, the following shortcuts are avai When using the Query Tool, the following shortcuts are available: -+--------------------------+------------------+-------------------------------------+ -| Shortcut (Windows/Linux) | Shortcut (Mac) | Function | -+==========================+==================+=====================================+ -| F5 | F5 | Execute query | -+--------------------------+------------------+-------------------------------------+ -| F7 | F7 | EXPLAIN query | -+--------------------------+------------------+-------------------------------------+ -| Shift+F7 | Shift+F7 | EXPLAIN ANALYZE query | -+--------------------------+------------------+-------------------------------------+ -| F8 | F8 | Execute query to CSV file | -+--------------------------+------------------+-------------------------------------+ -| Ctrl+Space | Ctrl+Space | Auto-complete | -+--------------------------+------------------+-------------------------------------+ \ No newline at end of file ++--------------------------+--------------------+-----------------------------------+ +| Shortcut (Windows/Linux) | Shortcut (Mac) | Function | ++==========================+====================+===================================+ +| F5 | F5 | Execute query | ++--------------------------+--------------------+-----------------------------------+ +| F7 | F7 | EXPLAIN query | ++--------------------------+--------------------+-----------------------------------+ +| Shift+F7 | Shift+F7 | EXPLAIN ANALYZE query | ++--------------------------+--------------------+-----------------------------------+ +| F8 | F8 | Execute query to CSV file | ++--------------------------+--------------------+-----------------------------------+ +| Alt+G | Alt+G | Jump (to line:column) | ++--------------------------+--------------------+-----------------------------------+ +| Ctrl+Space | Ctrl+Space | Auto-complete | ++--------------------------+--------------------+-----------------------------------+ +| Ctrl+F | Cmd+F | Find | ++--------------------------+--------------------+-----------------------------------+ +| Ctrl+G | Cmd+G | Find next | ++--------------------------+--------------------+-----------------------------------+ +| Shift+Ctrl+G | Shift+Cmd+G | Find previous | ++--------------------------+--------------------+-----------------------------------+ +| Shift+Ctrl+F | Shift+Cmd+F | Replace | ++--------------------------+--------------------+-----------------------------------+ +| Shift+Ctrl+R | Shift+Cmd+Option+F | Replace all | ++--------------------------+--------------------+-----------------------------------+ \ No newline at end of file diff --git a/web/pgadmin/browser/__init__.py b/web/pgadmin/browser/__init__.py index fb636c7c5..7a8e9f823 100644 --- a/web/pgadmin/browser/__init__.py +++ b/web/pgadmin/browser/__init__.py @@ -40,6 +40,7 @@ class BrowserModule(PgAdminModule): # Add browser stylesheets for (endpoint, filename) in [ ('static', 'css/codemirror/codemirror.css'), + ('static', 'js/codemirror/addon/dialog/dialog.css'), ('static', 'css/jQuery-contextMenu/jquery.contextMenu.css' if current_app.debug else 'css/jQuery-contextMenu/jquery.contextMenu.min.css'), ('static', 'css/wcDocker/wcDocker.css' if current_app.debug diff --git a/web/pgadmin/static/css/overrides.css b/web/pgadmin/static/css/overrides.css index 3c9fb1265..ad84aa768 100755 --- a/web/pgadmin/static/css/overrides.css +++ b/web/pgadmin/static/css/overrides.css @@ -1464,4 +1464,20 @@ body { -moz-user-select: text; -ms-user-select: text; user-select: text; -} \ No newline at end of file +} + +/* Codemirror buttons */ +.CodeMirror-dialog button { + font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; + color: white; + font-size: 70%; + background-image: -webkit-linear-gradient(top, #337ab7 0%, #265a88 100%); + background-image: -o-linear-gradient(top, #337ab7 0%, #265a88 100%); + background-image: -webkit-gradient(linear, left top, left bottom, from(#337ab7), to(#265a88)); + background-image: linear-gradient(to bottom, #337ab7 0%, #265a88 100%); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff265a88', GradientType=0); + filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); + background-repeat: repeat-x; + border-color: #245580; + border-radius: 4px; +} diff --git a/web/pgadmin/tools/datagrid/templates/datagrid/index.html b/web/pgadmin/tools/datagrid/templates/datagrid/index.html index 61820f92c..72ce75164 100644 --- a/web/pgadmin/tools/datagrid/templates/datagrid/index.html +++ b/web/pgadmin/tools/datagrid/templates/datagrid/index.html @@ -47,6 +47,54 @@ +
+ + + +