superset-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From maximebeauche...@apache.org
Subject [incubator-superset] branch master updated: allow user press Enter key to end editing title (#3112)
Date Mon, 17 Jul 2017 15:58:12 GMT
This is an automated email from the ASF dual-hosted git repository.

maximebeauchemin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git


The following commit(s) were added to refs/heads/master by this push:
     new 27fab0d  allow user press Enter key to end editing title (#3112)
27fab0d is described below

commit 27fab0d54f781830ec08f4c4296445415d9246bd
Author: Grace Guo <grace.guo@airbnb.com>
AuthorDate: Mon Jul 17 08:58:10 2017 -0700

    allow user press Enter key to end editing title (#3112)
---
 superset/assets/javascripts/components/EditableTitle.jsx | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/superset/assets/javascripts/components/EditableTitle.jsx b/superset/assets/javascripts/components/EditableTitle.jsx
index 70046f8..9d71388 100644
--- a/superset/assets/javascripts/components/EditableTitle.jsx
+++ b/superset/assets/javascripts/components/EditableTitle.jsx
@@ -23,6 +23,7 @@ class EditableTitle extends React.PureComponent {
     this.handleClick = this.handleClick.bind(this);
     this.handleBlur = this.handleBlur.bind(this);
     this.handleChange = this.handleChange.bind(this);
+    this.handleKeyPress = this.handleKeyPress.bind(this);
   }
   handleClick() {
     if (!this.props.canEdit) {
@@ -58,6 +59,13 @@ class EditableTitle extends React.PureComponent {
       title: ev.target.value,
     });
   }
+  handleKeyPress(ev) {
+    if (ev.key === 'Enter') {
+      ev.preventDefault();
+
+      this.handleBlur();
+    }
+  }
   render() {
     return (
       <span className="editable-title">
@@ -72,6 +80,7 @@ class EditableTitle extends React.PureComponent {
             onChange={this.handleChange}
             onBlur={this.handleBlur}
             onClick={this.handleClick}
+            onKeyPress={this.handleKeyPress}
           />
         </TooltipWrapper>
       </span>

-- 
To stop receiving notification emails like this one, please contact
['"commits@superset.apache.org" <commits@superset.apache.org>'].

Mime
View raw message