Skip to content

Commit

Permalink
Components: Query autocomplete by the term from last trigger prefix (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
WunderBart authored and ntsekouras committed Apr 7, 2021
1 parent e641ec8 commit 5e109ca
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/components/src/autocomplete/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -472,9 +472,9 @@ function Autocomplete( {
}

const safeTrigger = escapeRegExp( completer.triggerPrefix );
const match = text.match(
new RegExp( `${ safeTrigger }([\u0000-\uFFFF]*)$` )
);
const match = text
.slice( text.lastIndexOf( completer.triggerPrefix ) )
.match( new RegExp( `${ safeTrigger }([\u0000-\uFFFF]*)$` ) );
const query = match && match[ 1 ];

setAutocompleter( completer );
Expand Down

0 comments on commit 5e109ca

Please sign in to comment.