@@ -220,6 +220,27 @@ function CoverEdit( {
220220 overlayColor,
221221 } ;
222222
223+ const resizableCoverProps = {
224+ className : 'block-library-cover__resize-container' ,
225+ clientId,
226+ height,
227+ minHeight : parseFloat ( minHeight ) ,
228+ onResizeStart : ( ) => {
229+ setAttributes ( { minHeightUnit : 'px' } ) ;
230+ toggleSelection ( false ) ;
231+ } ,
232+ onResize : ( value ) => {
233+ setAttributes ( { minHeight : value } ) ;
234+ } ,
235+ onResizeStop : ( newMinHeight ) => {
236+ toggleSelection ( true ) ;
237+ setAttributes ( { minHeight : newMinHeight } ) ;
238+ } ,
239+ showHandle : true ,
240+ size : resizableBoxDimensions ,
241+ width,
242+ } ;
243+
223244 if ( ! hasInnerBlocks && ! hasBackground ) {
224245 return (
225246 < >
@@ -238,26 +259,7 @@ function CoverEdit( {
238259 currentSettings = { currentSettings }
239260 />
240261 { isSelected && (
241- < ResizableCoverPopover
242- clientId = { clientId }
243- className = "block-library-cover__resize-container is-placeholder"
244- minHeight = { parseFloat ( minHeight ) }
245- onResizeStart = { ( ) => {
246- setAttributes ( { minHeightUnit : 'px' } ) ;
247- toggleSelection ( false ) ;
248- } }
249- onResize = { ( value ) => {
250- setAttributes ( { minHeight : value } ) ;
251- } }
252- onResizeStop = { ( newMinHeight ) => {
253- toggleSelection ( true ) ;
254- setAttributes ( { minHeight : newMinHeight } ) ;
255- } }
256- showHandle = { true }
257- size = { { height : 'auto' , width : 'auto' } }
258- width = { width }
259- height = { height }
260- />
262+ < ResizableCoverPopover { ...resizableCoverProps } />
261263 ) }
262264 < div
263265 { ...blockProps }
@@ -319,28 +321,6 @@ function CoverEdit( {
319321 coverRef = { ref }
320322 currentSettings = { currentSettings }
321323 />
322- { isSelected && (
323- < ResizableCoverPopover
324- clientId = { clientId }
325- className = "block-library-cover__resize-container"
326- minHeight = { parseFloat ( minHeight ) }
327- onResizeStart = { ( ) => {
328- setAttributes ( { minHeightUnit : 'px' } ) ;
329- toggleSelection ( false ) ;
330- } }
331- onResize = { ( value ) => {
332- setAttributes ( { minHeight : value } ) ;
333- } }
334- onResizeStop = { ( newMinHeight ) => {
335- toggleSelection ( true ) ;
336- setAttributes ( { minHeight : newMinHeight } ) ;
337- } }
338- showHandle
339- size = { resizableBoxDimensions }
340- width = { width }
341- height = { height }
342- />
343- ) }
344324 < div
345325 { ...blockProps }
346326 className = { classnames ( classes , blockProps . className ) }
@@ -396,6 +376,9 @@ function CoverEdit( {
396376 />
397377 < div { ...innerBlocksProps } />
398378 </ div >
379+ { isSelected && (
380+ < ResizableCoverPopover { ...resizableCoverProps } />
381+ ) }
399382 </ >
400383 ) ;
401384}
0 commit comments