-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This tests well! And the multi-word searching still works as expected.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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