File tree Expand file tree Collapse file tree
admin/src/components/Input Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -94,16 +94,25 @@ const Tags = ({
9494 const inputValue = ( props . value && props . value . trim ( ) . toLowerCase ( ) ) || "" ;
9595 const inputLength = inputValue . length ;
9696
97- let s = suggestions ;
98-
99- if ( suggestions . length <= 0 ) {
97+ let s = suggestions . data ? suggestions . data : suggestions ;
98+ if ( suggestions <= 0 ) {
10099 getSuggestions ( ) ;
101100 }
102101
103102 if ( inputLength > 0 ) {
104- s = suggestions . filter ( ( state ) => {
105- return state . name . toLowerCase ( ) . slice ( 0 , inputLength ) === inputValue ;
106- } ) ;
103+ s = s . map ( ( state ) => {
104+ const suggestionName = state . attributes
105+ ? state . attributes . name . toLowerCase ( )
106+ : state . name . toLowerCase ( ) ;
107+
108+ if ( suggestionName . slice ( 0 , inputLength ) === inputValue ) {
109+ return {
110+ id : state . id ,
111+ name : suggestionName ,
112+ } ;
113+ }
114+ return null
115+ } ) . filter ( ( ele ) => ele !== null || ele != undefined ) ;
107116 }
108117
109118 return (
@@ -130,15 +139,17 @@ const Tags = ({
130139 // GenericInput calls formatMessage and returns a string for the error
131140 error = { error }
132141 hint = { description && formatMessage ( description ) }
133- required = { required } >
142+ required = { required }
143+ >
134144 < Flex
135145 direction = "column"
136146 alignItems = "stretch"
137147 gap = { 1 }
138148 style = { {
139149 position : `relative` ,
140150 } }
141- ref = { inputEle } >
151+ ref = { inputEle }
152+ >
142153 < FieldLabel action = { labelAction } > { formatMessage ( intlLabel ) } </ FieldLabel >
143154 < Flex direction = "column" >
144155 < TagsInput
Original file line number Diff line number Diff line change 11{
22 "name" : " strapi-plugin-tagsinput" ,
3- "version" : " 1.0.4 " ,
3+ "version" : " 1.0.5 " ,
44 "description" : " Tagsinput plugin for your strapi project" ,
55 "strapi" : {
66 "name" : " tagsinput" ,
You can’t perform that action at this time.
0 commit comments