mirror of
https://github.com/apache/superset.git
synced 2026-04-20 00:24:38 +00:00
allow user press Enter key to end editing title (#3112)
This commit is contained in:
committed by
Maxime Beauchemin
parent
091e93c831
commit
27fab0d54f
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user