mirror of
https://github.com/element-hq/element-web
synced 2024-11-26 03:05:51 +03:00
Maintain "blur to add" function to match previous UX
This commit is contained in:
parent
407a632a8d
commit
4e9694be6d
1 changed files with 6 additions and 2 deletions
|
@ -30,19 +30,22 @@ const EditableItem = React.createClass({
|
|||
onChange: PropTypes.func,
|
||||
onRemove: PropTypes.func,
|
||||
onAdd: PropTypes.func,
|
||||
|
||||
addOnChange: PropTypes.bool,
|
||||
},
|
||||
|
||||
onChange: function(value) {
|
||||
this.setState({ value });
|
||||
if (this.props.onChange) this.props.onChange(value, this.props.index);
|
||||
if (this.props.addOnChange && this.props.onAdd) this.props.onAdd(value);
|
||||
},
|
||||
|
||||
onRemove: function() {
|
||||
this.props.onRemove(this.props.index);
|
||||
if (this.props.onRemove) this.props.onRemove(this.props.index);
|
||||
},
|
||||
|
||||
onAdd: function() {
|
||||
this.props.onAdd(this.state.value);
|
||||
if (this.props.onAdd) this.props.onAdd(this.state.value);
|
||||
},
|
||||
|
||||
render: function() {
|
||||
|
@ -138,6 +141,7 @@ module.exports = React.createClass({
|
|||
initialValue={this.props.newItem}
|
||||
onAdd={this.onItemAdded}
|
||||
onChange={this.onNewItemChanged}
|
||||
addOnChange={true}
|
||||
placeholder={this.props.placeholder}
|
||||
/>
|
||||
</div>);
|
||||
|
|
Loading…
Reference in a new issue