Skip to content

Commit f4b0ccd

Browse files
authored
Merge pull request #54 from xsnippet/keypress-unique
Add unique attribute for tags and fixed keyPress issue
2 parents 9bfe889 + c8699c5 commit f4b0ccd

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/components/NewSnippet.jsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@ class NewSnippet extends React.Component {
2121
syntax: '', // eslint-disable-line react/no-unused-state
2222
};
2323
this.onKeyPress = (e) => {
24-
if (e.which === 13) { e.preventDefault(); }
24+
if (e.which === 13) { // keyCode for Enter button
25+
e.preventDefault();
26+
e.stopPropagation();
27+
}
2528
};
2629
this.postSnippet = this.postSnippet.bind(this);
2730
this.onSyntaxClick = this.onSyntaxClick.bind(this);
@@ -85,6 +88,7 @@ class NewSnippet extends React.Component {
8588
placeholder="Tags"
8689
onAdded={this.onTagAdded}
8790
onRemoved={this.onTagRemoved}
91+
uniqueTags
8892
/>
8993
</div>
9094
<div className="new-snippet-code">

0 commit comments

Comments
 (0)