Image size presets of the block image disappears when upgrading wordpress to ver
-
Hi, I updated wordpress and the Image size presets option that I was using before disappeared. I have the default theme of wordpress and it disappears when I upgrade, if I go back to wordpress version 6.2.2, it reappears.
This happens in the image gutenberg block.
I show screenshot of before and now.
Before
After
Now it shows the aspect ratio option, but that option does not do the same as the percentages that were there before: 25%, 50%, 75%, 100% and I used it frequently.
I have been looking in the core code and I have seen that it is still there, I don’t understand why it doesn’t appear.
How could I reactivate it in the new version of wordpress?
wp-includes/js/dist/block-editor.js
/** * Internal dependencies */ const IMAGE_SIZE_PRESETS = [25, 50, 75, 100]; const image_size_control_noop = () => {}; function ImageSizeControl({ imageSizeHelp, imageWidth, imageHeight, imageSizeOptions = [], isResizable = true, slug, width, height, onChange, onChangeImage = image_size_control_noop }) { external_wp_deprecated_default()('wp.blockEditor.__experimentalImageSizeControl', { since: '6.3', alternative: 'wp.blockEditor.privateApis.DimensionsTool and wp.blockEditor.privateApis.ResolutionTool' }); const { currentHeight, currentWidth, updateDimension, updateDimensions } = useDimensionHandler(height, width, imageHeight, imageWidth, onChange); return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, imageSizeOptions && imageSizeOptions.length > 0 && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.SelectControl, { __nextHasNoMarginBottom: true, label: (0,external_wp_i18n_namespaceObject.__)('Resolution'), value: slug, options: imageSizeOptions, onChange: onChangeImage, help: imageSizeHelp, size: "__unstable-large" }), isResizable && (0,external_wp_element_namespaceObject.createElement)("div", { className: "block-editor-image-size-control" }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, { align: "baseline", spacing: "3" }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNumberControl, { className: "block-editor-image-size-control__width", label: (0,external_wp_i18n_namespaceObject.__)('Width'), value: currentWidth, min: 1, onChange: value => updateDimension('width', value), size: "__unstable-large" }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNumberControl, { className: "block-editor-image-size-control__height", label: (0,external_wp_i18n_namespaceObject.__)('Height'), value: currentHeight, min: 1, onChange: value => updateDimension('height', value), size: "__unstable-large" })), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ButtonGroup, { "aria-label": (0,external_wp_i18n_namespaceObject.__)('Image size presets') }, IMAGE_SIZE_PRESETS.map(scale => { const scaledWidth = Math.round(imageWidth * (scale / 100)); const scaledHeight = Math.round(imageHeight * (scale / 100)); const isCurrent = currentWidth === scaledWidth && currentHeight === scaledHeight; return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { key: scale, isSmall: true, variant: isCurrent ? 'primary' : undefined, isPressed: isCurrent, onClick: () => updateDimensions(scaledHeight, scaledWidth) }, scale, "%"); })), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { isSmall: true, onClick: () => updateDimensions() }, (0,external_wp_i18n_namespaceObject.__)('Reset'))))); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/link-control/settings-drawer.js
- The topic ‘Image size presets of the block image disappears when upgrading wordpress to ver’ is closed to new replies.