From 84ff6d4d602b8b6792ad5fade7b3a3fff969cc77 Mon Sep 17 00:00:00 2001 From: George Mamadashvili Date: Wed, 12 May 2021 07:39:39 +0400 Subject: [PATCH] Media & Text: Add media width control (#31002) --- packages/block-library/src/media-text/edit.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/packages/block-library/src/media-text/edit.js b/packages/block-library/src/media-text/edit.js index 41134d2693c4a..5ecc79f02cd64 100644 --- a/packages/block-library/src/media-text/edit.js +++ b/packages/block-library/src/media-text/edit.js @@ -22,6 +22,7 @@ import { } from '@wordpress/block-editor'; import { PanelBody, + RangeControl, TextareaControl, ToggleControl, ToolbarButton, @@ -49,6 +50,7 @@ const TEMPLATE = [ }, ], ]; + // this limits the resize to a safe zone to avoid making broken layouts const WIDTH_CONSTRAINT_PERCENTAGE = 15; const applyWidthConstraints = ( width ) => @@ -276,6 +278,15 @@ function MediaTextEdit( { attributes, isSelected, setAttributes } ) { isResizable={ false } /> ) } + { mediaUrl && ( + + ) } );