@@ -124,30 +124,37 @@ export default function Image( {
124124 } ,
125125 [ id , isSelected , clientId ]
126126 ) ;
127- const { canInsertCover, imageEditing, imageSizes, mediaUpload } = useSelect (
128- ( select ) => {
129- const { getBlockRootClientId, getSettings, canInsertBlockType } =
130- select ( blockEditorStore ) ;
131-
132- const rootClientId = getBlockRootClientId ( clientId ) ;
133- const settings = Object . fromEntries (
134- Object . entries ( getSettings ( ) ) . filter ( ( [ key ] ) =>
135- [ 'imageEditing' , 'imageSizes' , 'mediaUpload' ] . includes (
136- key
127+ const { canInsertCover, imageEditing, imageSizes, maxWidth, mediaUpload } =
128+ useSelect (
129+ ( select ) => {
130+ const {
131+ getBlockRootClientId,
132+ getSettings,
133+ canInsertBlockType,
134+ } = select ( blockEditorStore ) ;
135+
136+ const rootClientId = getBlockRootClientId ( clientId ) ;
137+ const settings = Object . fromEntries (
138+ Object . entries ( getSettings ( ) ) . filter ( ( [ key ] ) =>
139+ [
140+ 'imageEditing' ,
141+ 'imageSizes' ,
142+ 'maxWidth' ,
143+ 'mediaUpload' ,
144+ ] . includes ( key )
137145 )
138- )
139- ) ;
146+ ) ;
140147
141- return {
142- ...settings ,
143- canInsertCover : canInsertBlockType (
144- 'core/cover' ,
145- rootClientId
146- ) ,
147- } ;
148- } ,
149- [ clientId ]
150- ) ;
148+ return {
149+ ...settings ,
150+ canInsertCover : canInsertBlockType (
151+ 'core/cover' ,
152+ rootClientId
153+ ) ,
154+ } ;
155+ } ,
156+ [ clientId ]
157+ ) ;
151158 const { replaceBlocks, toggleSelection } = useDispatch ( blockEditorStore ) ;
152159 const { createErrorNotice, createSuccessNotice } =
153160 useDispatch ( noticesStore ) ;
@@ -548,9 +555,13 @@ export default function Image( {
548555 // With the current implementation of ResizableBox, an image needs an
549556 // explicit pixel value for the max-width. In absence of being able to
550557 // set the content-width, this max-width is currently dictated by the
551- // vanilla editor style. We'll use the clientWidth here, to prevent the width
552- // of the image growing larger than the width of the block column.
553- const maxWidthBuffer = clientWidth ;
558+ // vanilla editor style. The following variable adds a buffer to this
559+ // vanilla style, so 3rd party themes have some wiggleroom. This does,
560+ // in most cases, allow you to scale the image beyond the width of the
561+ // main column, though not infinitely.
562+ // @todo It would be good to revisit this once a content-width variable
563+ // becomes available.
564+ const maxWidthBuffer = maxWidth * 2.5 ;
554565
555566 let showRightHandle = false ;
556567 let showLeftHandle = false ;
0 commit comments