public inbox for [email protected]
help / color / mirror / Atom feedFrom: Surinder Kumar <[email protected]>
To: pgadmin-hackers <[email protected]>
Subject: [pgAdmin4][Patch]: RM#1478 - Make code mirror text editor keyboard shortcuts consistent irrespective of platform type
Date: Fri, 5 Aug 2016 23:12:40 +0530
Message-ID: <CAM5-9D8ExeecjY6Mk7iZ_ZFs+iyLr1-6QtJR0djYvSO_65NtEw@mail.gmail.com> (raw)
List-Unsubscribe: <mailto:[email protected]?body=unsub%20pgadmin-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'
view thread (7+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected]
Subject: Re: [pgAdmin4][Patch]: RM#1478 - Make code mirror text editor keyboard shortcuts consistent irrespective of platform type
In-Reply-To: <CAM5-9D8ExeecjY6Mk7iZ_ZFs+iyLr1-6QtJR0djYvSO_65NtEw@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox