public inbox for [email protected]help / color / mirror / Atom feed
[pgAdmin4][Patch]: RM#1478 - Make code mirror text editor keyboard shortcuts consistent irrespective of platform type 7+ messages / 2 participants [nested] [flat]
* [pgAdmin4][Patch]: RM#1478 - Make code mirror text editor keyboard shortcuts consistent irrespective of platform type @ 2016-08-05 17:42 Surinder Kumar <[email protected]> 0 siblings, 1 reply; 7+ messages in thread From: Surinder Kumar @ 2016-08-05 17:42 UTC (permalink / raw) To: pgadmin-hackers Hi I found that *Code-mirror* library itself provides the List of keyboard shortcuts for Mac OSX and other platform type. We just need to pass them in extraKeys param while creating code-mirror instance. *Following is the keyboard shortcuts for various operations in text editor:* 1. Copy - [Ctrl-C, Cmd-C] 2. Cut - [Ctrl-X, Cmd-X] 3. Select All - [Ctrl-A, Cmd-A] 4. Undo - [Ctrl-Z, Cmd-Z] 5. Redo - [Ctrl-Y, Cmd-Y] 6. Delete Line - [Ctrl-D, Cmd-D] 7. Move left/right(words) - [Alt-Left, Alt-Right] 8. Move start/end of line - [Cmd-Left, Cmd-Right] // *Ctrl-Left/Right* are bound to System shortcuts. so these keys cannot be used. These keyboard shortcuts are consistent in Web/Runtime applications in all platform types. *Issue not fixed:* keyboard shortcut for *Paste text* doesn't work in Mac Runtime only. It is working on Linux runtime & Windows Runtime. An issue "Key shortcuts doesn't work on Mac OS for QWebView widget <https://bugreports.qt.io/browse/QTBUG-46330?jql=project%20%3D%20QTBUG%20AND%20resolution%20%3D%20Unr...; is also reported. I also found that right click paste is working in Mac Runtime which is the feature of code-mirror, So I am looking into its code to figure out and I will send a patch with fix once it gets fixed. Please find attached patch and review. Thanks, Surinder Kumar -- Sent via pgadmin-hackers mailing list ([email protected]) To make changes to your subscription: http://www.postgresql.org/mailpref/pgadmin-hackers Attachments: [application/octet-stream] RM1478_v1.patch (2.9K, 3-RM1478_v1.patch) download | inline diff: diff --git a/web/pgadmin/tools/datagrid/templates/datagrid/js/datagrid.js b/web/pgadmin/tools/datagrid/templates/datagrid/js/datagrid.js index 1cb9c1e..664d7eb 100644 --- a/web/pgadmin/tools/datagrid/templates/datagrid/js/datagrid.js +++ b/web/pgadmin/tools/datagrid/templates/datagrid/js/datagrid.js @@ -243,7 +243,8 @@ define( lineWrapping: true, matchBrackets: true, indentUnit: 4, - mode: "text/x-pgsql" + mode: "text/x-pgsql", + extraKeys: pgAdmin.editor_shortcut_keys }); }, diff --git a/web/pgadmin/tools/sqleditor/templates/sqleditor/js/sqleditor.js b/web/pgadmin/tools/sqleditor/templates/sqleditor/js/sqleditor.js index c364aad..fbef184 100644 --- a/web/pgadmin/tools/sqleditor/templates/sqleditor/js/sqleditor.js +++ b/web/pgadmin/tools/sqleditor/templates/sqleditor/js/sqleditor.js @@ -32,6 +32,36 @@ define( F7_KEY = 118, F8_KEY = 119; + /* + * List of shortcut keys supported for basic + * operations in text editor. Shortcuts are + * consistent irrespective of platform type. + */ + var editor_shortcut_keys = pgAdmin.editor_shortcut_keys = { + // Autocomplete sql command + "Ctrl-Space": "autocomplete", + "Cmd-Space": "autocomplete", + // Select All text + "Ctrl-A": "selectAll", + "Cmd-A": "selectAll", + // Redo text + "Ctrl-Y": "redo", + "Cmd-Y": "redo", + // Undo text + "Ctrl-Z": "undo", + "Cmd-Z": "undo", + // Delete Line + "Ctrl-D": "deleteLine", + "Cmd-D": "deleteLine", + // Go to beginning of line + "Cmd-Left": "goLineStart", + // Go to end of Line + "Cmd-Right": "goLineEnd", + // Move word by word left/right + "Alt-Left": "goGroupLeft", + "Alt-Right": "goGroupRight" + }; + // Defining the backbone model for the sql grid var sqlEditorViewModel = Backbone.Model.extend({ @@ -206,7 +236,8 @@ define( rangeFinder: CodeMirror.fold.combine(CodeMirror.pgadminBeginRangeFinder, CodeMirror.pgadminIfRangeFinder, CodeMirror.pgadminLoopRangeFinder, CodeMirror.pgadminCaseRangeFinder) }, - gutters: ["CodeMirror-linenumbers", "CodeMirror-foldgutter"] + gutters: ["CodeMirror-linenumbers", "CodeMirror-foldgutter"], + extraKeys: editor_shortcut_keys }); // Create main wcDocker instance @@ -248,7 +279,7 @@ define( CodeMirror.pgadminLoopRangeFinder, CodeMirror.pgadminCaseRangeFinder) }, gutters: ["CodeMirror-linenumbers", "CodeMirror-foldgutter"], - extraKeys: {"Ctrl-Space": "autocomplete"} + extraKeys: editor_shortcut_keys }); // Create panels for 'Data Output', 'Explain', 'Messages' and 'History' ^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: [pgAdmin4][Patch]: RM#1478 - Make code mirror text editor keyboard shortcuts consistent irrespective of platform type @ 2016-08-08 11:13 Dave Page <[email protected]> parent: Surinder Kumar <[email protected]> 0 siblings, 1 reply; 7+ messages in thread From: Dave Page @ 2016-08-08 11:13 UTC (permalink / raw) To: Surinder Kumar <[email protected]>; +Cc: pgadmin-hackers Hi Surinder, This looks very promising, but it only covers the query tool at present. We need the shortcuts to apply to all codemirror instances. Do the others work anyway, because we're invoking in a different way, or is more work needed there? On Fri, Aug 5, 2016 at 6:42 PM, Surinder Kumar <[email protected]> wrote: > Hi > > I found that Code-mirror library itself provides the List of keyboard > shortcuts for Mac OSX and other platform type. > We just need to pass them in extraKeys param while creating code-mirror > instance. > > Following is the keyboard shortcuts for various operations in text editor: > > Copy - [Ctrl-C, Cmd-C] > Cut - [Ctrl-X, Cmd-X] > Select All - [Ctrl-A, Cmd-A] > Undo - [Ctrl-Z, Cmd-Z] > Redo - [Ctrl-Y, Cmd-Y] > Delete Line - [Ctrl-D, Cmd-D] > Move left/right(words) - [Alt-Left, Alt-Right] > Move start/end of line - [Cmd-Left, Cmd-Right] // Ctrl-Left/Right are bound > to System shortcuts. so these keys cannot be used. > > These keyboard shortcuts are consistent in Web/Runtime applications in all > platform types. > > Issue not fixed: > keyboard shortcut for Paste text doesn't work in Mac Runtime only. It is > working on Linux runtime & Windows Runtime. > An issue "Key shortcuts doesn't work on Mac OS for QWebView widget" is also > reported. > > I also found that right click paste is working in Mac Runtime which is the > feature of code-mirror, So I am looking into its code to figure out and I > will send a patch with fix once it gets fixed. > > Please find attached patch and review. > > > Thanks, > Surinder Kumar > > > > -- > Sent via pgadmin-hackers mailing list ([email protected]) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgadmin-hackers > -- Dave Page Blog: http://pgsnake.blogspot.com Twitter: @pgsnake EnterpriseDB UK: http://www.enterprisedb.com The Enterprise PostgreSQL Company -- Sent via pgadmin-hackers mailing list ([email protected]) To make changes to your subscription: http://www.postgresql.org/mailpref/pgadmin-hackers ^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: [pgAdmin4][Patch]: RM#1478 - Make code mirror text editor keyboard shortcuts consistent irrespective of platform type @ 2016-08-08 12:15 Surinder Kumar <[email protected]> parent: Dave Page <[email protected]> 0 siblings, 1 reply; 7+ messages in thread From: Surinder Kumar @ 2016-08-08 12:15 UTC (permalink / raw) To: Dave Page <[email protected]>; +Cc: pgadmin-hackers On Mon, Aug 8, 2016 at 4:43 PM, Dave Page <[email protected]> wrote: > Hi Surinder, > > This looks very promising, but it only covers the query tool at > present. We need the shortcuts to apply to all codemirror instances. > Do the others work anyway, because we're invoking in a different way, > or is more work needed there? To apply the same shortcuts to other codemirror instances(e.g: SqlTabControl) we just need to set a parameter *extraKeys: pgAdmin.editor_shortcut_keys *for every codemirror instance. As of now, shortcuts are applicable to *query tool & data filter*. Also, we need to define *pgAdmin.editor_shortcut_keys *variable in server.js instead of sqleditor.js to work it for other code mirror instances. > On Fri, Aug 5, 2016 at 6:42 PM, Surinder Kumar > <[email protected]> wrote: > > Hi > > > > I found that Code-mirror library itself provides the List of keyboard > > shortcuts for Mac OSX and other platform type. > > We just need to pass them in extraKeys param while creating code-mirror > > instance. > > > > Following is the keyboard shortcuts for various operations in text > editor: > > > > Copy - [Ctrl-C, Cmd-C] > > Cut - [Ctrl-X, Cmd-X] > > Select All - [Ctrl-A, Cmd-A] > > Undo - [Ctrl-Z, Cmd-Z] > > Redo - [Ctrl-Y, Cmd-Y] > > Delete Line - [Ctrl-D, Cmd-D] > > Move left/right(words) - [Alt-Left, Alt-Right] > > Move start/end of line - [Cmd-Left, Cmd-Right] // Ctrl-Left/Right are > bound > > to System shortcuts. so these keys cannot be used. > > > > These keyboard shortcuts are consistent in Web/Runtime applications in > all > > platform types. > > > > Issue not fixed: > > keyboard shortcut for Paste text doesn't work in Mac Runtime only. It is > > working on Linux runtime & Windows Runtime. > > An issue "Key shortcuts doesn't work on Mac OS for QWebView widget" is > also > > reported. > > > > I also found that right click paste is working in Mac Runtime which is > the > > feature of code-mirror, So I am looking into its code to figure out and I > > will send a patch with fix once it gets fixed. > > > > Please find attached patch and review. > > > > > > Thanks, > > Surinder Kumar > > > > > > > > -- > > Sent via pgadmin-hackers mailing list ([email protected]) > > To make changes to your subscription: > > http://www.postgresql.org/mailpref/pgadmin-hackers > > > > > > -- > Dave Page > Blog: http://pgsnake.blogspot.com > Twitter: @pgsnake > > EnterpriseDB UK: http://www.enterprisedb.com > The Enterprise PostgreSQL Company > ^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: [pgAdmin4][Patch]: RM#1478 - Make code mirror text editor keyboard shortcuts consistent irrespective of platform type @ 2016-08-08 12:22 Dave Page <[email protected]> parent: Surinder Kumar <[email protected]> 0 siblings, 1 reply; 7+ messages in thread From: Dave Page @ 2016-08-08 12:22 UTC (permalink / raw) To: Surinder Kumar <[email protected]>; +Cc: pgadmin-hackers On Mon, Aug 8, 2016 at 1:15 PM, Surinder Kumar <[email protected]> wrote: > On Mon, Aug 8, 2016 at 4:43 PM, Dave Page <[email protected]> wrote: >> >> Hi Surinder, >> >> This looks very promising, but it only covers the query tool at >> present. We need the shortcuts to apply to all codemirror instances. >> Do the others work anyway, because we're invoking in a different way, >> or is more work needed there? > > To apply the same shortcuts to other codemirror instances(e.g: > SqlTabControl) we just need to set a parameter > extraKeys: pgAdmin.editor_shortcut_keys for every codemirror instance. > As of now, shortcuts are applicable to query tool & data filter. > > Also, we need to define pgAdmin.editor_shortcut_keys variable in server.js > instead of sqleditor.js to work it for > other code mirror instances. OK, please update the patch to do that. Can you get that to me in the next hour or so? I'd like to include it in beta 4. >> On Fri, Aug 5, 2016 at 6:42 PM, Surinder Kumar >> <[email protected]> wrote: >> > Hi >> > >> > I found that Code-mirror library itself provides the List of keyboard >> > shortcuts for Mac OSX and other platform type. >> > We just need to pass them in extraKeys param while creating code-mirror >> > instance. >> > >> > Following is the keyboard shortcuts for various operations in text >> > editor: >> > >> > Copy - [Ctrl-C, Cmd-C] >> > Cut - [Ctrl-X, Cmd-X] >> > Select All - [Ctrl-A, Cmd-A] >> > Undo - [Ctrl-Z, Cmd-Z] >> > Redo - [Ctrl-Y, Cmd-Y] >> > Delete Line - [Ctrl-D, Cmd-D] >> > Move left/right(words) - [Alt-Left, Alt-Right] >> > Move start/end of line - [Cmd-Left, Cmd-Right] // Ctrl-Left/Right are >> > bound >> > to System shortcuts. so these keys cannot be used. >> > >> > These keyboard shortcuts are consistent in Web/Runtime applications in >> > all >> > platform types. >> > >> > Issue not fixed: >> > keyboard shortcut for Paste text doesn't work in Mac Runtime only. It is >> > working on Linux runtime & Windows Runtime. >> > An issue "Key shortcuts doesn't work on Mac OS for QWebView widget" is >> > also >> > reported. >> > >> > I also found that right click paste is working in Mac Runtime which is >> > the >> > feature of code-mirror, So I am looking into its code to figure out and >> > I >> > will send a patch with fix once it gets fixed. >> > >> > Please find attached patch and review. >> > >> > >> > Thanks, >> > Surinder Kumar >> > >> > >> > >> > -- >> > Sent via pgadmin-hackers mailing list ([email protected]) >> > To make changes to your subscription: >> > http://www.postgresql.org/mailpref/pgadmin-hackers >> > >> >> >> >> -- >> Dave Page >> Blog: http://pgsnake.blogspot.com >> Twitter: @pgsnake >> >> EnterpriseDB UK: http://www.enterprisedb.com >> The Enterprise PostgreSQL Company > > -- Dave Page Blog: http://pgsnake.blogspot.com Twitter: @pgsnake EnterpriseDB UK: http://www.enterprisedb.com The Enterprise PostgreSQL Company -- Sent via pgadmin-hackers mailing list ([email protected]) To make changes to your subscription: http://www.postgresql.org/mailpref/pgadmin-hackers ^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: [pgAdmin4][Patch]: RM#1478 - Make code mirror text editor keyboard shortcuts consistent irrespective of platform type @ 2016-08-08 12:23 Surinder Kumar <[email protected]> parent: Dave Page <[email protected]> 0 siblings, 1 reply; 7+ messages in thread From: Surinder Kumar @ 2016-08-08 12:23 UTC (permalink / raw) To: Dave Page <[email protected]>; +Cc: pgadmin-hackers On Mon, Aug 8, 2016 at 5:52 PM, Dave Page <[email protected]> wrote: > On Mon, Aug 8, 2016 at 1:15 PM, Surinder Kumar > <[email protected]> wrote: > > On Mon, Aug 8, 2016 at 4:43 PM, Dave Page <[email protected]> wrote: > >> > >> Hi Surinder, > >> > >> This looks very promising, but it only covers the query tool at > >> present. We need the shortcuts to apply to all codemirror instances. > >> Do the others work anyway, because we're invoking in a different way, > >> or is more work needed there? > > > > To apply the same shortcuts to other codemirror instances(e.g: > > SqlTabControl) we just need to set a parameter > > extraKeys: pgAdmin.editor_shortcut_keys for every codemirror instance. > > As of now, shortcuts are applicable to query tool & data filter. > > > > Also, we need to define pgAdmin.editor_shortcut_keys variable in > server.js > > instead of sqleditor.js to work it for > > other code mirror instances. > > OK, please update the patch to do that. > > Can you get that to me in the next hour or so? I'd like to include it in > beta 4. > Sure. > > >> On Fri, Aug 5, 2016 at 6:42 PM, Surinder Kumar > >> <[email protected]> wrote: > >> > Hi > >> > > >> > I found that Code-mirror library itself provides the List of keyboard > >> > shortcuts for Mac OSX and other platform type. > >> > We just need to pass them in extraKeys param while creating > code-mirror > >> > instance. > >> > > >> > Following is the keyboard shortcuts for various operations in text > >> > editor: > >> > > >> > Copy - [Ctrl-C, Cmd-C] > >> > Cut - [Ctrl-X, Cmd-X] > >> > Select All - [Ctrl-A, Cmd-A] > >> > Undo - [Ctrl-Z, Cmd-Z] > >> > Redo - [Ctrl-Y, Cmd-Y] > >> > Delete Line - [Ctrl-D, Cmd-D] > >> > Move left/right(words) - [Alt-Left, Alt-Right] > >> > Move start/end of line - [Cmd-Left, Cmd-Right] // Ctrl-Left/Right are > >> > bound > >> > to System shortcuts. so these keys cannot be used. > >> > > >> > These keyboard shortcuts are consistent in Web/Runtime applications in > >> > all > >> > platform types. > >> > > >> > Issue not fixed: > >> > keyboard shortcut for Paste text doesn't work in Mac Runtime only. It > is > >> > working on Linux runtime & Windows Runtime. > >> > An issue "Key shortcuts doesn't work on Mac OS for QWebView widget" is > >> > also > >> > reported. > >> > > >> > I also found that right click paste is working in Mac Runtime which is > >> > the > >> > feature of code-mirror, So I am looking into its code to figure out > and > >> > I > >> > will send a patch with fix once it gets fixed. > >> > > >> > Please find attached patch and review. > >> > > >> > > >> > Thanks, > >> > Surinder Kumar > >> > > >> > > >> > > >> > -- > >> > Sent via pgadmin-hackers mailing list ([email protected] > ) > >> > To make changes to your subscription: > >> > http://www.postgresql.org/mailpref/pgadmin-hackers > >> > > >> > >> > >> > >> -- > >> Dave Page > >> Blog: http://pgsnake.blogspot.com > >> Twitter: @pgsnake > >> > >> EnterpriseDB UK: http://www.enterprisedb.com > >> The Enterprise PostgreSQL Company > > > > > > > > -- > Dave Page > Blog: http://pgsnake.blogspot.com > Twitter: @pgsnake > > EnterpriseDB UK: http://www.enterprisedb.com > The Enterprise PostgreSQL Company > ^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: [pgAdmin4][Patch]: RM#1478 - Make code mirror text editor keyboard shortcuts consistent irrespective of platform type @ 2016-08-08 13:34 Surinder Kumar <[email protected]> parent: Surinder Kumar <[email protected]> 0 siblings, 1 reply; 7+ messages in thread From: Surinder Kumar @ 2016-08-08 13:34 UTC (permalink / raw) To: Dave Page <[email protected]>; +Cc: pgadmin-hackers Hi Dave, This patch contains following changes: 1. Add "*editor_shortcut_keys*" variable to *pgAdmin.Browser* in *browser.js* object to make it accessible to all pgAdmin modules. 2. Apply shortcuts keys to following code mirror instances: a) Query tool, Query filter & Datagrid. b) Debugger tool. c) Sql Panel. d) SqlTab & SqlField Controls. Please find updated patch and review. On Mon, Aug 8, 2016 at 5:53 PM, Surinder Kumar < [email protected]> wrote: > On Mon, Aug 8, 2016 at 5:52 PM, Dave Page <[email protected]> wrote: > >> On Mon, Aug 8, 2016 at 1:15 PM, Surinder Kumar >> <[email protected]> wrote: >> > On Mon, Aug 8, 2016 at 4:43 PM, Dave Page <[email protected]> wrote: >> >> >> >> Hi Surinder, >> >> >> >> This looks very promising, but it only covers the query tool at >> >> present. We need the shortcuts to apply to all codemirror instances. >> >> Do the others work anyway, because we're invoking in a different way, >> >> or is more work needed there? >> > >> > To apply the same shortcuts to other codemirror instances(e.g: >> > SqlTabControl) we just need to set a parameter >> > extraKeys: pgAdmin.editor_shortcut_keys for every codemirror instance. >> > As of now, shortcuts are applicable to query tool & data filter. >> > >> > Also, we need to define pgAdmin.editor_shortcut_keys variable in >> server.js >> > instead of sqleditor.js to work it for >> > other code mirror instances. >> >> OK, please update the patch to do that. >> >> Can you get that to me in the next hour or so? I'd like to include it in >> beta 4. >> > Sure. > >> >> >> On Fri, Aug 5, 2016 at 6:42 PM, Surinder Kumar >> >> <[email protected]> wrote: >> >> > Hi >> >> > >> >> > I found that Code-mirror library itself provides the List of keyboard >> >> > shortcuts for Mac OSX and other platform type. >> >> > We just need to pass them in extraKeys param while creating >> code-mirror >> >> > instance. >> >> > >> >> > Following is the keyboard shortcuts for various operations in text >> >> > editor: >> >> > >> >> > Copy - [Ctrl-C, Cmd-C] >> >> > Cut - [Ctrl-X, Cmd-X] >> >> > Select All - [Ctrl-A, Cmd-A] >> >> > Undo - [Ctrl-Z, Cmd-Z] >> >> > Redo - [Ctrl-Y, Cmd-Y] >> >> > Delete Line - [Ctrl-D, Cmd-D] >> >> > Move left/right(words) - [Alt-Left, Alt-Right] >> >> > Move start/end of line - [Cmd-Left, Cmd-Right] // Ctrl-Left/Right >> are >> >> > bound >> >> > to System shortcuts. so these keys cannot be used. >> >> > >> >> > These keyboard shortcuts are consistent in Web/Runtime applications >> in >> >> > all >> >> > platform types. >> >> > >> >> > Issue not fixed: >> >> > keyboard shortcut for Paste text doesn't work in Mac Runtime only. >> It is >> >> > working on Linux runtime & Windows Runtime. >> >> > An issue "Key shortcuts doesn't work on Mac OS for QWebView widget" >> is >> >> > also >> >> > reported. >> >> > >> >> > I also found that right click paste is working in Mac Runtime which >> is >> >> > the >> >> > feature of code-mirror, So I am looking into its code to figure out >> and >> >> > I >> >> > will send a patch with fix once it gets fixed. >> >> > >> >> > Please find attached patch and review. >> >> > >> >> > >> >> > Thanks, >> >> > Surinder Kumar >> >> > >> >> > >> >> > >> >> > -- >> >> > Sent via pgadmin-hackers mailing list ([email protected] >> g) >> >> > To make changes to your subscription: >> >> > http://www.postgresql.org/mailpref/pgadmin-hackers >> >> > >> >> >> >> >> >> >> >> -- >> >> Dave Page >> >> Blog: http://pgsnake.blogspot.com >> >> Twitter: @pgsnake >> >> >> >> EnterpriseDB UK: http://www.enterprisedb.com >> >> The Enterprise PostgreSQL Company >> > >> > >> >> >> >> -- >> Dave Page >> Blog: http://pgsnake.blogspot.com >> Twitter: @pgsnake >> >> EnterpriseDB UK: http://www.enterprisedb.com >> The Enterprise PostgreSQL Company >> > > -- Sent via pgadmin-hackers mailing list ([email protected]) To make changes to your subscription: http://www.postgresql.org/mailpref/pgadmin-hackers Attachments: [application/octet-stream] RM1478_v2.patch (4.7K, 3-RM1478_v2.patch) download | inline diff: diff --git a/web/pgadmin/browser/templates/browser/js/browser.js b/web/pgadmin/browser/templates/browser/js/browser.js index 95528b0..5b7e626 100644 --- a/web/pgadmin/browser/templates/browser/js/browser.js +++ b/web/pgadmin/browser/templates/browser/js/browser.js @@ -320,7 +320,8 @@ function(require, $, _, S, Bootstrap, pgAdmin, alertify, CodeMirror) { lineNumbers: true, lineWrapping: true, mode: "text/x-pgsql", - readOnly: true + readOnly: true, + extraKeys: pgAdmin.Browser.editor_shortcut_keys }); setTimeout(function() { @@ -708,6 +709,31 @@ function(require, $, _, S, Bootstrap, pgAdmin, alertify, CodeMirror) { }); return preference; + }, + + editor_shortcut_keys: { + // Autocomplete sql command + "Ctrl-Space": "autocomplete", + "Cmd-Space": "autocomplete", + // Select All text + "Ctrl-A": "selectAll", + "Cmd-A": "selectAll", + // Redo text + "Ctrl-Y": "redo", + "Cmd-Y": "redo", + // Undo text + "Ctrl-Z": "undo", + "Cmd-Z": "undo", + // Delete Line + "Ctrl-D": "deleteLine", + "Cmd-D": "deleteLine", + // Go to beginning of line + "Cmd-Left": "goLineStart", + // Go to end of Line + "Cmd-Right": "goLineEnd", + // Move word by word left/right + "Alt-Left": "goGroupLeft", + "Alt-Right": "goGroupRight" } }); diff --git a/web/pgadmin/static/js/backform.pgadmin.js b/web/pgadmin/static/js/backform.pgadmin.js index bc7d434..a741ade 100644 --- a/web/pgadmin/static/js/backform.pgadmin.js +++ b/web/pgadmin/static/js/backform.pgadmin.js @@ -1392,7 +1392,8 @@ lineNumbers: true, lineWrapping: true, mode: "text/x-pgsql", - readOnly: true + readOnly: true, + extraKeys: pgAdmin.Browser.editor_shortcut_keys }); return this; @@ -2118,7 +2119,8 @@ (self.$el.find("textarea")[0]), { lineNumbers: true, mode: "text/x-sql", - readOnly: isDisabled + readOnly: isDisabled, + extraKeys: pgAdmin.Browser.editor_shortcut_keys }); if (!isVisible) diff --git a/web/pgadmin/tools/datagrid/templates/datagrid/js/datagrid.js b/web/pgadmin/tools/datagrid/templates/datagrid/js/datagrid.js index 1cb9c1e..7e8901c 100644 --- a/web/pgadmin/tools/datagrid/templates/datagrid/js/datagrid.js +++ b/web/pgadmin/tools/datagrid/templates/datagrid/js/datagrid.js @@ -243,7 +243,8 @@ define( lineWrapping: true, matchBrackets: true, indentUnit: 4, - mode: "text/x-pgsql" + mode: "text/x-pgsql", + extraKeys: pgBrowser.editor_shortcut_keys }); }, diff --git a/web/pgadmin/tools/debugger/templates/debugger/js/direct.js b/web/pgadmin/tools/debugger/templates/debugger/js/direct.js index 60a6710..676bff4 100644 --- a/web/pgadmin/tools/debugger/templates/debugger/js/direct.js +++ b/web/pgadmin/tools/debugger/templates/debugger/js/direct.js @@ -1422,7 +1422,8 @@ define( }, gutters: ["CodeMirror-linenumbers", "CodeMirror-foldgutter", "breakpoints"], mode: "text/x-pgsql", - readOnly: true + readOnly: true, + extraKeys: pgAdmin.Browser.editor_shortcut_keys }); // On loading the docker, register the callbacks diff --git a/web/pgadmin/tools/sqleditor/templates/sqleditor/js/sqleditor.js b/web/pgadmin/tools/sqleditor/templates/sqleditor/js/sqleditor.js index 2be2b49..41d8661 100644 --- a/web/pgadmin/tools/sqleditor/templates/sqleditor/js/sqleditor.js +++ b/web/pgadmin/tools/sqleditor/templates/sqleditor/js/sqleditor.js @@ -206,7 +206,8 @@ define( rangeFinder: CodeMirror.fold.combine(CodeMirror.pgadminBeginRangeFinder, CodeMirror.pgadminIfRangeFinder, CodeMirror.pgadminLoopRangeFinder, CodeMirror.pgadminCaseRangeFinder) }, - gutters: ["CodeMirror-linenumbers", "CodeMirror-foldgutter"] + gutters: ["CodeMirror-linenumbers", "CodeMirror-foldgutter"], + extraKeys: pgBrowser.editor_shortcut_keys }); // Create main wcDocker instance @@ -248,7 +249,7 @@ define( CodeMirror.pgadminLoopRangeFinder, CodeMirror.pgadminCaseRangeFinder) }, gutters: ["CodeMirror-linenumbers", "CodeMirror-foldgutter"], - extraKeys: {"Ctrl-Space": "autocomplete"} + extraKeys: pgBrowser.editor_shortcut_keys }); // Create panels for 'Data Output', 'Explain', 'Messages' and 'History' ^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: [pgAdmin4][Patch]: RM#1478 - Make code mirror text editor keyboard shortcuts consistent irrespective of platform type @ 2016-08-08 14:48 Dave Page <[email protected]> parent: Surinder Kumar <[email protected]> 0 siblings, 0 replies; 7+ messages in thread From: Dave Page @ 2016-08-08 14:48 UTC (permalink / raw) To: Surinder Kumar <[email protected]>; +Cc: pgadmin-hackers Thanks, applied with minor changes per our discussion on skype. On Mon, Aug 8, 2016 at 2:34 PM, Surinder Kumar <[email protected]> wrote: > Hi Dave, > > This patch contains following changes: > > Add "editor_shortcut_keys" variable to pgAdmin.Browser in browser.js object > to make it accessible to all pgAdmin modules. > Apply shortcuts keys to following code mirror instances: > > a) Query tool, Query filter & Datagrid. > b) Debugger tool. > c) Sql Panel. > d) SqlTab & SqlField Controls. > > Please find updated patch and review. > > On Mon, Aug 8, 2016 at 5:53 PM, Surinder Kumar > <[email protected]> wrote: >> >> On Mon, Aug 8, 2016 at 5:52 PM, Dave Page <[email protected]> wrote: >>> >>> On Mon, Aug 8, 2016 at 1:15 PM, Surinder Kumar >>> <[email protected]> wrote: >>> > On Mon, Aug 8, 2016 at 4:43 PM, Dave Page <[email protected]> wrote: >>> >> >>> >> Hi Surinder, >>> >> >>> >> This looks very promising, but it only covers the query tool at >>> >> present. We need the shortcuts to apply to all codemirror instances. >>> >> Do the others work anyway, because we're invoking in a different way, >>> >> or is more work needed there? >>> > >>> > To apply the same shortcuts to other codemirror instances(e.g: >>> > SqlTabControl) we just need to set a parameter >>> > extraKeys: pgAdmin.editor_shortcut_keys for every codemirror instance. >>> > As of now, shortcuts are applicable to query tool & data filter. >>> > >>> > Also, we need to define pgAdmin.editor_shortcut_keys variable in >>> > server.js >>> > instead of sqleditor.js to work it for >>> > other code mirror instances. >>> >>> OK, please update the patch to do that. >>> >>> Can you get that to me in the next hour or so? I'd like to include it in >>> beta 4. >> >> Sure. >>> >>> >>> >> On Fri, Aug 5, 2016 at 6:42 PM, Surinder Kumar >>> >> <[email protected]> wrote: >>> >> > Hi >>> >> > >>> >> > I found that Code-mirror library itself provides the List of >>> >> > keyboard >>> >> > shortcuts for Mac OSX and other platform type. >>> >> > We just need to pass them in extraKeys param while creating >>> >> > code-mirror >>> >> > instance. >>> >> > >>> >> > Following is the keyboard shortcuts for various operations in text >>> >> > editor: >>> >> > >>> >> > Copy - [Ctrl-C, Cmd-C] >>> >> > Cut - [Ctrl-X, Cmd-X] >>> >> > Select All - [Ctrl-A, Cmd-A] >>> >> > Undo - [Ctrl-Z, Cmd-Z] >>> >> > Redo - [Ctrl-Y, Cmd-Y] >>> >> > Delete Line - [Ctrl-D, Cmd-D] >>> >> > Move left/right(words) - [Alt-Left, Alt-Right] >>> >> > Move start/end of line - [Cmd-Left, Cmd-Right] // Ctrl-Left/Right >>> >> > are >>> >> > bound >>> >> > to System shortcuts. so these keys cannot be used. >>> >> > >>> >> > These keyboard shortcuts are consistent in Web/Runtime applications >>> >> > in >>> >> > all >>> >> > platform types. >>> >> > >>> >> > Issue not fixed: >>> >> > keyboard shortcut for Paste text doesn't work in Mac Runtime only. >>> >> > It is >>> >> > working on Linux runtime & Windows Runtime. >>> >> > An issue "Key shortcuts doesn't work on Mac OS for QWebView widget" >>> >> > is >>> >> > also >>> >> > reported. >>> >> > >>> >> > I also found that right click paste is working in Mac Runtime which >>> >> > is >>> >> > the >>> >> > feature of code-mirror, So I am looking into its code to figure out >>> >> > and >>> >> > I >>> >> > will send a patch with fix once it gets fixed. >>> >> > >>> >> > Please find attached patch and review. >>> >> > >>> >> > >>> >> > Thanks, >>> >> > Surinder Kumar >>> >> > >>> >> > >>> >> > >>> >> > -- >>> >> > Sent via pgadmin-hackers mailing list >>> >> > ([email protected]) >>> >> > To make changes to your subscription: >>> >> > http://www.postgresql.org/mailpref/pgadmin-hackers >>> >> > >>> >> >>> >> >>> >> >>> >> -- >>> >> Dave Page >>> >> Blog: http://pgsnake.blogspot.com >>> >> Twitter: @pgsnake >>> >> >>> >> EnterpriseDB UK: http://www.enterprisedb.com >>> >> The Enterprise PostgreSQL Company >>> > >>> > >>> >>> >>> >>> -- >>> Dave Page >>> Blog: http://pgsnake.blogspot.com >>> Twitter: @pgsnake >>> >>> EnterpriseDB UK: http://www.enterprisedb.com >>> The Enterprise PostgreSQL Company >> >> > -- Dave Page Blog: http://pgsnake.blogspot.com Twitter: @pgsnake EnterpriseDB UK: http://www.enterprisedb.com The Enterprise PostgreSQL Company -- Sent via pgadmin-hackers mailing list ([email protected]) To make changes to your subscription: http://www.postgresql.org/mailpref/pgadmin-hackers ^ permalink raw reply [nested|flat] 7+ messages in thread
end of thread, other threads:[~2016-08-08 14:48 UTC | newest] Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2016-08-05 17:42 [pgAdmin4][Patch]: RM#1478 - Make code mirror text editor keyboard shortcuts consistent irrespective of platform type Surinder Kumar <[email protected]> 2016-08-08 11:13 ` Dave Page <[email protected]> 2016-08-08 12:15 ` Surinder Kumar <[email protected]> 2016-08-08 12:22 ` Dave Page <[email protected]> 2016-08-08 12:23 ` Surinder Kumar <[email protected]> 2016-08-08 13:34 ` Surinder Kumar <[email protected]> 2016-08-08 14:48 ` Dave Page <[email protected]>
This inbox is served by agora; see mirroring instructions for how to clone and mirror all data and code used for this inbox