Components: Query autocomplete by the term from last trigger prefix character#30540
Conversation
|
Size Change: +6 B (0%) Total Size: 1.42 MB
ℹ️ View Unchanged
|
fullofcaffeine
left a comment
There was a problem hiding this comment.
This tests well! And the multi-word searching still works as expected.
noahtallen
left a comment
There was a problem hiding this comment.
I verified that multiword search works (e.g. @Noah Allen or /Instagram Posts) as does multiple searches per block (@noahtallen @WunderBart)
|
We have
|
| new RegExp( `${ safeTrigger }([\u0000-\uFFFF]*)$` ) | ||
| ); | ||
| const match = text | ||
| .slice( text.lastIndexOf( completer.triggerPrefix ) ) |
There was a problem hiding this comment.
Good catch, it makes a lot of sense.
It feels like we could update the RegExp to match the last occurrence (rather than using slice), but I'm afraid it would be harder to follow for those who need to google it like me:
https://frightanic.com/software-development/regex-match-last-occurrence/
gziolo
left a comment
There was a problem hiding this comment.
Nice one, thank you for fixing it. Do you consider it as a candidate for the hotfix release? We can coordinate on WordPress Slack in the #core-editor channel.
Description
Fixes an issue introduced in #29939, where the search won't retrigger when more than one inline trigger prefix is present.
How has this been tested?
The autocomplete search results should appear every time the search trigger is typed, i.e. the user search via⚠️ The above does not apply to the block search because of its custom allowContext condition.)
@.(
Confirm that searching blocks via multiple words is still working as described in #29939.
Types of changes
Bugfix