VideoPress: fix Wide width and Full alignment not rendering in editor#50255
VideoPress: fix Wide width and Full alignment not rendering in editor#50255shsajalchowdhury wants to merge 2 commits into
Conversation
When VideoPress replaces the core video block, it wraps the content in a ResizableBox with explicit width constraints. This overrides the wide/full alignment styles applied by the editor, causing the block to render at normal width even when wide/full alignment is set. Fix: Disable the ResizableBox resize handles and set width to 100% when the block has wide or full alignment. Add editor CSS to ensure the embed wrapper expands to fill the wider figure. Fixes Automattic#43807
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 Jetpack plugin: No scheduled milestone found for this plugin. If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. |
| @@ -0,0 +1,4 @@ | |||
| Significance: patch | |||
| Type: fixed | |||
There was a problem hiding this comment.
Could you create the changelog entry again? This is incorrect.
Error: Type must be "major", "enhancement", "compat", "bugfix", or "other".
I would recommend using the built-in CLI tool to generate those entries, to avoid such issues.
| Type: fixed | |
| Type: bugfix |
obenland
left a comment
There was a problem hiding this comment.
Thank you for your work on this @shsajalchowdhury!
The issue noted that the required styles already exist and that the wrapper element just breaks the selector. Rather than adding custom styles, could you see if something like this would work in a backwards compatible way? We wouldn't want to break error message displays that were fixed in #21253.
diff --git a/projects/plugins/jetpack/extensions/blocks/videopress/edit.js b/projects/plugins/jetpack/extensions/blocks/videopress/edit.js
index 20d83d8e96..e78aafd029 100644
--- a/projects/plugins/jetpack/extensions/blocks/videopress/edit.js
+++ b/projects/plugins/jetpack/extensions/blocks/videopress/edit.js
@@ -911,9 +911,25 @@ const VideoPressEdit = CoreVideoEdit =>
const displayCoreVideoBlock =
renderCoreVideoAndLoadingBlocks && ! isUploading && ! isFetchingVideo;
- // In order for the media placeholder to keep its state for error messages, we need to keep the CoreVideoEdit component in the tree during file uploads.
- // Keep this section separate so the CoreVideoEdit stays in the tree, once we have a video, we don't need it anymore.
- const coreVideoFragment = (
+ /*
+ * local video (plain core or VideoPress fallback): render bare. A wrapper <div>
+ * breaks wide/full alignment — the <figure> must be a direct child of the block list.
+ */
+ const displayLocalVideo = displayCoreVideoBlock && !! src && ! isBlobURL( src );
+
+ /*
+ * Otherwise toggle both with `videopress-block-hide` — keeping one CoreVideoEdit
+ * instance mounted preserves the placeholder's error message across upload.
+ */
+ const coreVideoFragment = displayLocalVideo ? (
+ <CoreVideoEdit { ...this.props } />
+ ) : (
<Fragment>
<div className={ ! isUploading && ! isFetchingVideo ? 'videopress-block-hide' : '' }>
<Loading
What
Fixes #43807
Why
When VideoPress is enabled, it replaces the core video block's edit component and wraps the video preview in a
ResizableBoxwith explicit width constraints. This overrides the editor's wide/full alignment styles, causing the block to render at normal width even when "Wide width" or "Full" alignment is selected.How
align: 'wide'oralign: 'full'— resizing doesn't make sense for these alignmentsResizableBoxwidth to100%when aligned, so the content fills the wider figure element.wp-block-embed__wrapperexpands to fill the aligned figureTesting Instructions
Changelog
Does this pull request change what data or activity we track or use?
No. This change only affects the visual rendering of the VideoPress block in the editor — it does not collect, log, or transmit any new data.
Testing instructions
Does this pull request change what data or activity we track or use?
No. This change only affects the visual rendering of the VideoPress block in the editor — it does not collect, log, or transmit any new data.
Testing instructions