@@ -22,35 +22,6 @@ let Tags = React.createClass({
22
22
. catch ( ( reason ) => {
23
23
console . error ( reason ) ;
24
24
} ) ;
25
-
26
- this . shimTagDelimiter ( ) ;
27
- } ,
28
- shimTagDelimiter : function ( ) {
29
- // The ReactTags component for some reason does not
30
- // do tag seperation on anything except "enter" which is
31
- // not an intuitive key when you're on a single-line input.
32
- // We are adding a hack here to force delimiting on comma.
33
- // Ideally, this hack can be taken out again after
34
- // https://github.com/i-like-robots/react-tags/issues/76 is addressed.
35
- try {
36
- const reactTags = this . reactTags ;
37
- const trueInput = reactTags . input . input ;
38
- const forceKey = reactTags . handleKeyDown . bind ( reactTags ) ;
39
-
40
- trueInput . addEventListener ( "keyup" , evt => {
41
- // did we type a comma?
42
- const key = evt . key ;
43
- if ( key === ',' ) {
44
- // remove the comma and type an enter instead
45
- const { query, selectedIndex } = reactTags . state ;
46
- reactTags . state . query = query . substring ( 0 , query . length - 1 ) ;
47
- forceKey ( { keyCode : 13 , preventDefault : ( ) => { } } ) ;
48
- }
49
- } ) ;
50
-
51
- } catch ( e ) {
52
- console . warning ( "Could not set up comma-delimiting for tags" ) ;
53
- }
54
25
} ,
55
26
updateTags : function ( tags ) {
56
27
this . setState ( { tags } , ( ) => {
@@ -80,15 +51,17 @@ let Tags = React.createClass({
80
51
} ) . filter ( suggestion => ! ! suggestion ) ;
81
52
} ,
82
53
render : function ( ) {
54
+ let delimiters = [ 9 , 13 , 32 , 188 ] ; // keycodes for tab,enter,space,comma
83
55
84
56
return < ReactTags
85
57
ref = { e => this . reactTags = e }
86
58
tags = { this . state . tags }
87
59
suggestions = { this . getFilteredSuggestions ( ) }
88
60
allowNew = { true }
61
+ autofocus = { false }
62
+ delimiters = { delimiters }
89
63
handleDelete = { ( ...args ) => this . handleDelete ( ...args ) }
90
64
handleAddition = { ( ...args ) => this . handleAddition ( ...args ) }
91
- autofocus = { false }
92
65
classNames = { {
93
66
root : `react-tags form-control d-flex flex-column flex-sm-row` ,
94
67
selectedTag : `selected-tag btn btn-sm mr-sm-2 my-1` ,
0 commit comments