@@ -77,7 +77,9 @@ class Mentions extends React.Component<MentionsProps, MentionsState> {
7777 }
7878
7979 public textarea ?: HTMLTextAreaElement ;
80+
8081 public measure ?: HTMLDivElement ;
82+
8183 public focusId : number | undefined = undefined ;
8284
8385 constructor ( props : MentionsProps ) {
@@ -98,7 +100,7 @@ class Mentions extends React.Component<MentionsProps, MentionsState> {
98100
99101 // Sync measure div top with textarea for rc-trigger usage
100102 if ( measuring ) {
101- this . measure ! . scrollTop = this . textarea ! . scrollTop ;
103+ this . measure . scrollTop = this . textarea . scrollTop ;
102104 }
103105 }
104106
@@ -138,7 +140,6 @@ class Mentions extends React.Component<MentionsProps, MentionsState> {
138140 event . preventDefault ( ) ;
139141 } else if ( which === KeyCode . ESC ) {
140142 this . stopMeasure ( ) ;
141- return ;
142143 } else if ( which === KeyCode . ENTER ) {
143144 // Measure hit
144145 const option = this . getOptions ( ) [ activeIndex ] ;
@@ -177,8 +178,8 @@ class Mentions extends React.Component<MentionsProps, MentionsState> {
177178
178179 if ( measureIndex !== - 1 ) {
179180 const measureText = selectionStartText . slice ( measureIndex + measurePrefix . length ) ;
180- const validateMeasure : boolean = validateSearch ! ( measureText , this . props ) ;
181- const matchOption : boolean = ! ! this . getOptions ( measureText ) . length ;
181+ const validateMeasure : boolean = validateSearch ( measureText , this . props ) ;
182+ const matchOption = ! ! this . getOptions ( measureText ) . length ;
182183
183184 if ( validateMeasure ) {
184185 if (
@@ -247,13 +248,13 @@ class Mentions extends React.Component<MentionsProps, MentionsState> {
247248 measureLocation,
248249 targetText : mentionValue ,
249250 prefix : measurePrefix ,
250- selectionStart : this . textarea ! . selectionStart ,
251- split : split ! ,
251+ selectionStart : this . textarea . selectionStart ,
252+ split,
252253 } ) ;
253254 this . triggerChange ( text ) ;
254255 this . stopMeasure ( ( ) => {
255256 // We need restore the selection position
256- setInputSelection ( this . textarea ! , selectionLocation ) ;
257+ setInputSelection ( this . textarea , selectionLocation ) ;
257258 } ) ;
258259
259260 if ( onSelect ) {
@@ -285,7 +286,7 @@ class Mentions extends React.Component<MentionsProps, MentionsState> {
285286 if ( filterOption === false ) {
286287 return true ;
287288 }
288- return filterOption ! ( targetMeasureText , option ) ;
289+ return filterOption ( targetMeasureText , option ) ;
289290 } ) ;
290291 return list ;
291292 } ;
@@ -312,11 +313,11 @@ class Mentions extends React.Component<MentionsProps, MentionsState> {
312313 }
313314
314315 public focus ( ) {
315- this . textarea ! . focus ( ) ;
316+ this . textarea . focus ( ) ;
316317 }
317318
318319 public blur ( ) {
319- this . textarea ! . blur ( ) ;
320+ this . textarea . blur ( ) ;
320321 }
321322
322323 public render ( ) {
@@ -377,7 +378,7 @@ class Mentions extends React.Component<MentionsProps, MentionsState> {
377378 transitionName = { transitionName }
378379 placement = { placement }
379380 options = { options }
380- visible = { true }
381+ visible
381382 >
382383 < span > { measurePrefix } </ span >
383384 </ KeywordTrigger >
0 commit comments