-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Editor: Add search functionality to template swapping modal #69667
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
Editor: Add search functionality to template swapping modal #69667
Conversation
23601d1
to
18ee52f
Compare
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. |
packages/editor/src/components/post-template/swap-template-button.js
Outdated
Show resolved
Hide resolved
6cb7c2f
to
20f124c
Compare
Hi, @Mamaduka. I believe I've addressed all the feedback. Whenever you have a chance, could you give it another review? Thanks! |
<SearchControl | ||
__nextHasNoMarginBottom | ||
onChange={ setSearchValue } | ||
value={ searchValue } | ||
label={ __( 'Search' ) } | ||
placeholder={ __( 'Search' ) } | ||
className="editor-post-template__swap-template-search" | ||
/> |
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.
Currently, the searchValue
state doesn't reset after you close the modal. I think we need to move the search control inside the + its state inside the TemplatesList
or create a new component that wraps around both. This way, the local state will reset when the modal component unmounts.
Screencast
CleanShot.2025-04-15.at.15.34.00.mp4
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.
Sorry, I didn't notice this in my testing. I’ve factored it in and updated the PR in the latest commit. Thanks for pointing it out!
This fixes a bug where the search state was getting preserved even after closing the modal.
93085ab
to
51bb99f
Compare
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.
Thank you, @yogeshbhutkar!
Thank you! |
…s#69667) Co-authored-by: yogeshbhutkar <yogeshbhutkar@git.wordpress.org> Co-authored-by: Mamaduka <mamaduka@git.wordpress.org> Co-authored-by: t-hamano <wildworks@git.wordpress.org> Co-authored-by: carolinan <poena@git.wordpress.org>
What?
Closes #69659
This PR introduces search functionality to the template selection modal, making it easier to find templates efficiently.
Why?
When dealing with a large number of templates, filtering by title makes selection much more convenient.
How?
These changes are aligned with the search functionality in the
pattern selection
dialog to maintain consistency.Testing Instructions
Template
, thenChange template
.Screencast
pr.mov