-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Site Editor: Reuse inserter search term normalization #60218
Conversation
Size Change: -55 B (0%) Total Size: 1.72 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.
LGTM
extractWords
and normalizeString
are now private exports from packages/block-editor/src/components/inserter/search-items.js and don't occur anywhere else
Searching inserter works as expected in post and site editors, testing using some accents as well. 👍🏻
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
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.
Thanks for cleaning this up! 🙇
✅ Inserter search works in both editors
✅ Patterns search in the site editor works
✅ Code changes look good
LGTM 👍
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.
* Block Editor: Expose inserter search term normalization utils * Edit Site: Use search term normalization utils from block editor * Edit Site: Remove remove-accents dependency Co-authored-by: tyxla <[email protected]> Co-authored-by: ramonjd <[email protected]> Co-authored-by: aaronrobertshaw <[email protected]> Co-authored-by: jsnajdr <[email protected]>
* Block Editor: Expose inserter search term normalization utils * Edit Site: Use search term normalization utils from block editor * Edit Site: Remove remove-accents dependency Co-authored-by: tyxla <[email protected]> Co-authored-by: ramonjd <[email protected]> Co-authored-by: aaronrobertshaw <[email protected]> Co-authored-by: jsnajdr <[email protected]>
What?
In #60080 (comment) @jsnajdr spotted that much of the search term normalization logic is being duplicated.
This PR deduplicates a big part of the search term normalization functionality that is essentially copied from the block editor.
Why?
To avoid duplication and to reuse code that already has some testing coverage.
How?
We're exposing those utilities as private APIs for the block editor and reusing them in the site editor. This also allows us to remove a direct dependency from the
edit-site
package.There are more opportunities for deduplication, but I prefer addressing them in smaller and more digestible pieces.
Testing Instructions
Testing Instructions for Keyboard
None
Screenshots or screencast
None