mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-04 03:52:40 +00:00
Update tag keydown handler to allow tags that match a certain pattern
#758
This commit is contained in:
@@ -202,14 +202,19 @@ const MetadataEditor = createClass({
|
|||||||
},
|
},
|
||||||
handleTagInputKeyDown : function(event, index){
|
handleTagInputKeyDown : function(event, index){
|
||||||
if(event.key === 'Enter') {
|
if(event.key === 'Enter') {
|
||||||
if(!!index) {
|
const tagPattern = /^(?:(?:group|meta|system|type):)?[A-Za-z0-9][A-Za-z0-9 /.:\-]+$/;
|
||||||
this.updateTag(event.target.value, index);
|
if(!!event.target.value.match(tagPattern)) {
|
||||||
const tagContext = this.state.tagContext;
|
if(!!index) {
|
||||||
tagContext[index].editing = false;
|
this.updateTag(event.target.value, index);
|
||||||
this.setState({ tagContext, updateTag: '' });
|
const tagContext = this.state.tagContext;
|
||||||
|
tagContext[index].editing = false;
|
||||||
|
this.setState({ tagContext, updateTag: '' });
|
||||||
|
} else {
|
||||||
|
this.addTag(event.target.value);
|
||||||
|
this.setState({ temporaryTag: '' });
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
this.addTag(event.target.value);
|
console.log('does not match');
|
||||||
this.setState({ temporaryTag: '' });
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user