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. |
|
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. |
jeherve
left a comment
There was a problem hiding this comment.
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 <anomiex@users.noreply.github.com> * 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 <anomiex@users.noreply.github.com> Co-authored-by: Brandon Kraft <public@brandonkraft.com>
…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 <anomiex@users.noreply.github.com> * 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 <anomiex@users.noreply.github.com> Co-authored-by: Brandon Kraft <public@brandonkraft.com>


Fixes #15578
Changes proposed in this Pull Request:
aorbutton, 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 anurlattribute (with an URL as value).urlin 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 anuniqueIdattribute (any value will do).data-id-attrandidattributes are set to theuniqueIddefined above.inputelement.Proposed changelog entry for your changes: