-
Notifications
You must be signed in to change notification settings - Fork 846
VideoPress: Prevent jetpack/videopress block removing align attribute from core/video block. #16627
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
Conversation
|
Caution: This PR has changes that must be merged to WordPress.com |
This is an automated check which relies on E2E results is available here (for debugging purposes): https://jetpack-e2e-dashboard.herokuapp.com/pr-16627 |
| type: 'boolean', | ||
| default: true, | ||
| }, | ||
| ...settings.attributes, |
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.
Could do
| ...settings.attributes, | |
| ...attributes, |
since attributes is being destructured on R66.
ockham
left a comment
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 is unfortunately currently breaking the block for me (even without setting alignment): After saving and reloading, I get an 'Invalid block' message:
(The same doesn't happen on master.)
This is the block HTML that's saved on this branch:
<!-- wp:video {"id":329,"guid":"cKxRo2fW"} -->
<figure class="wp-block-video wp-block-embed is-type-video is-provider-videopress"><div class="wp-block-embed__wrapper">
https://videopress.com/v/cKxRo2fW?preloadContent=metadata
</div></figure>
<!-- /wp:video -->Note that the src attribute is missing from the block.
Compare that to the block HTML on master:
<!-- wp:video {"guid":"cKxRo2fW","id":329,"src":"https://videos.files.wordpress.com/cKxRo2fW/can-search-for-a-blog-name-can-see-and-select-a-free-wordpress-com-blog-address-in-results-2019-03-11t12-50-20_hd.mp4"} -->
<figure class="wp-block-video wp-block-embed is-type-video is-provider-videopress"><div class="wp-block-embed__wrapper">
https://videopress.com/v/cKxRo2fW?preloadContent=metadata
</div></figure>
<!-- /wp:video -->|
I think I see the issue: The This works, since the <!-- wp:video {"id":322} -->
<figure class="wp-block-video"><video controls src="http://deadbeef.ngrok.io/wp-content/uploads/2020/05/can-publish-and-view-content-2019-03-11T12-50-16.mpg"></video></figure>
<!-- /wp:video -->However, the VideoPress block HTML doesn't have a <!-- wp:video {"id":329,"guid":"cKxRo2fW"} -->
<figure class="wp-block-video wp-block-embed is-type-video is-provider-videopress"><div class="wp-block-embed__wrapper">
https://videopress.com/v/cKxRo2fW?preloadContent=metadata
</div></figure>
<!-- /wp:video --> |
|
This is true for most of the |
|
Some additional notes: The Handling of that field is implemented in https://github.com/WordPress/gutenberg/blob/6cce6e0fdbb27d496370d48305913523e3251ea1/packages/block-editor/src/hooks/align.js, mostly through a number of filters that
Since the VideoPress block inherits the I think the answer is that we're attaching the VideoPress wrapper to the same filter that Gutenberg's |
|
That seems to work. I'll file a PR 😊 |
|
Superceded by #16651 |

This PR fixes
core/videoblock losingalignattribute when editor is reloaded.This is happening because
jetpack/videopressblock is recreating thecore/video's block attributes (when it should inherit them). Thealignattribute was introduced incore/video's block which was not recreated byjetpack/videopress's hook.Changes proposed in this Pull Request:
Inherit
core/video's block attributes instead of recreating them.Before: https://www.screencast.com/t/eGCIAAci4Q1l
After: https://www.screencast.com/t/fitMKygi
More debugging context here: Automattic/wp-calypso#43252
Does this pull request change what data or activity we track or use?
No
Testing instructions:
Proposed changelog entry for your changes:
Fixes #16158