-
Notifications
You must be signed in to change notification settings - Fork 798
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: Properly render inner HTML if context-appropriate #15595
Conversation
Thank you for the great PR description! When this PR is ready for review, please apply the Scheduled Jetpack release: May 5, 2020. |
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
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.
Caution: This PR has changes that must be merged to WordPress.com |
@jeherve That's exactly what the future Though, I didn't consider this kind of use case. Actually, it replaces
I've marked the change as to be removed when Gutenberg 8.0 is our minimum supported version, which means that we can fully rely on |
This works for me. It is a slightly odd experience hitting enter or shift-enter and getting a space, but seemed to produce string with correct spacing in all instances, including copy/paste. I am a bit late to the party on the button discussions, so apologies if this has already been covered, but would it be possible to only strip line breaks of the block |
Good point @glendaviesnz! Unfortunately, DOMDocument doesn't easily allow nesting HTML content. |
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 seems to test well for me. Merging.
In the future and as we'll probably use the Button block more and more, I think it would be nice to add some tests to cover the different functions in extensions/blocks/button/button.php
. Maybe in a future PR?
Cherry-picked to |
r206786-wpcom |
…s WP 5.9 (#24086) * General: remove backwards compatibility code for user queries See #22559 * Update PHPUnit setup to remove WP < 5.9 oddities See #21175, #21157 Primary issue: #24082 * Update docs/examples/bootstrap.php Co-authored-by: Brad Jorsch <[email protected]> * Remove speed trap listener loder * Update doc to remove mention of temporary PHPUnit situation * Remove temporary line break workaround See #15595 * Remove custom function in favor of the one that ships with core * Remove old workaround for the Jetpack sidebar plugin icon See #14327 * Remove PHP 5.2 workaround See 99fffd8 * Add back necessary _wp_specialchars wrapping Co-authored-by: Brad Jorsch <[email protected]> Co-authored-by: Brandon Kraft <[email protected]>
…Jetpack requires WP 5.9 (#24086) * General: remove backwards compatibility code for user queries See #22559 * Update PHPUnit setup to remove WP < 5.9 oddities See #21175, #21157 Primary issue: #24082 * Update docs/examples/bootstrap.php Co-authored-by: Brad Jorsch <[email protected]> * Remove speed trap listener loder * Update doc to remove mention of temporary PHPUnit situation * Remove temporary line break workaround See #15595 * Remove custom function in favor of the one that ships with core * Remove old workaround for the Jetpack sidebar plugin icon See #14327 * Remove PHP 5.2 workaround See 99fffd8 * Add back necessary _wp_specialchars wrapping Co-authored-by: Brad Jorsch <[email protected]> Co-authored-by: Brandon Kraft <[email protected]>
Fixes #15578
Changes proposed in this Pull Request:
a
orbutton
, make sure the inner HTML is rendered.input
, prevent inserting newlines and strip any HTML tags.Testing instructions:
Now modify the Revue inner block definition.
a
, and add anurl
attribute (with an URL as value).url
in a new tab (also it should have the following attributes:target="_blank" role="button" rel="noopener noreferrer"
).Modify the Revue inner block definition again.
input
, and add anuniqueId
attribute (any value will do).data-id-attr
andid
attributes are set to theuniqueId
defined above.input
element.Proposed changelog entry for your changes: