-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Button Block: Add draft page creation capability #69368
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
Button Block: Add draft page creation capability #69368
Conversation
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 contributing, @dhruvikpatel18!
I think we can reduce boilerplate code here by using the same approach as the Link format. See the InlineLinkUI
component for details.
@Mamaduka Thanks for the feedbacks, I have refactored the code and reduced boilerplate code by leveraging existing |
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 the follow-up, @dhruvikpatel18!
Do you mind rebasing this branch on top of the latest trunk? I've also left two suggestions.
const { getSettings } = select( blockEditorStore ); | ||
const _settings = getSettings(); |
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.
const { getSettings } = select( blockEditorStore ); | |
const _settings = getSettings(); | |
const _settings = select( blockEditorStore ).getSettings(); |
Suggestion (non-blocking): This could be a one liner.
showInitialSuggestions | ||
suggestionsQuery={ getSuggestionsQuery( | ||
'page', | ||
'post-type' | ||
) } |
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.
showInitialSuggestions | |
suggestionsQuery={ getSuggestionsQuery( | |
'page', | |
'post-type' | |
) } |
Let's disable initial suggestions for now and only display them when the user starts typing/searching.
Hi, @dhruvikpatel18 Do you have time to follow up on the remaining suggestions? Also, let's rebase this branch on top of the latest trunk. |
71daa11
to
a992f46
Compare
Hi @Mamaduka, I've implemented your suggestion and removed the |
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, @dhruvikpatel18!
The enhancement implementation looks good ✅
Co-authored-by: dhruvikpatel18 <dhruvik18@git.wordpress.org> Co-authored-by: Mamaduka <mamaduka@git.wordpress.org> Co-authored-by: ajlende <ajlende@git.wordpress.org>
Closes #56163
What?
This PR adds the ability to create draft pages directly from the button block in the navigation editor, similar to how it already works in the navigation link block.
Why?
Currently, users can create a draft page from the custom link block in the navigation editor if the page doesn't exist, but this functionality isn't available in the button block. This PR addresses this inconsistency by implementing the same feature in the button block, providing a more consistent editing experience.
How?
Testing Instructions
Screenshots or screencast
Before
Screen.Recording.2025-02-28.at.2.21.54.PM.mov
After
Screen.Recording.2025-02-28.at.2.34.04.PM.mov