This is an automated email from the ASF dual-hosted git repository.

acote pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/couchdb-fauxton.git


The following commit(s) were added to refs/heads/master by this push:
     new c53b1b5  Run query when pressing Ctrl-Enter in query editor (#1136)
c53b1b5 is described below

commit c53b1b59a16d74ae8d18d57347256ebb4503bce1
Author: Alexis Côté <[email protected]>
AuthorDate: Wed Oct 10 18:34:04 2018 -0400

    Run query when pressing Ctrl-Enter in query editor (#1136)
---
 app/addons/documents/mango/components/MangoQueryEditor.js | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/app/addons/documents/mango/components/MangoQueryEditor.js 
b/app/addons/documents/mango/components/MangoQueryEditor.js
index f04a158..15ef83a 100644
--- a/app/addons/documents/mango/components/MangoQueryEditor.js
+++ b/app/addons/documents/mango/components/MangoQueryEditor.js
@@ -35,6 +35,20 @@ export default class MangoQueryEditor extends Component {
     this.props.loadQueryHistory({ databaseName: this.props.databaseName });
     // Clear results list in case it was populated by other pages
     this.props.clearResults();
+
+    // Add key binding to run query when doing Ctrl-Enter
+    const editor = this.codeEditor.codeEditor.editor;
+    const runQueryCmdName = "runQuery";
+    if (!editor.commands.byName[runQueryCmdName]) {
+      editor.commands.addCommand({
+        name: runQueryCmdName,
+        bindKey: {win: 'Ctrl-Enter', mac: 'Command-Option-Enter'},
+        exec: () => {
+          this.runQuery({preventDefault: () => {}});
+        },
+        readOnly: true
+      });
+    }
   }
 
   componentDidUpdate (prevProps) {

Reply via email to