0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-24 20:42:43 +00:00

Add autoFocus functionality when editing tags and allow for multi-tag entry by comma separation

#758
This commit is contained in:
Charlie Humphreys
2021-11-17 23:56:57 -06:00
parent 330bf20d61
commit 19c13342c4

View File

@@ -182,7 +182,7 @@ const MetadataEditor = createClass({
},
addTag : function(tag){
this.props.metadata.tags = _.uniq([...this.props.metadata.tags, tag]);
this.props.metadata.tags = _.uniq([...this.props.metadata.tags, ...(tag.split(',').map((t)=>t.trim()))]);
this.props.onChange(this.props.metadata);
},
removeTag : function(tag){
@@ -216,7 +216,7 @@ const MetadataEditor = createClass({
renderTags : function(){
const tagElements = Object.values(this.state.tagContext).map((context, i)=>context.editing
? <input type='text' className='value'
? <input type='text' className='value' autoFocus
value={this.state.updateTag}
key={i}
onKeyDown={(e)=>{ this.handleTagInputKeyDown(e, i); }}