Remove height and width inputs (“Image Dimensions”) from core/image
-
I’d like to remove the height and width inputs from the core/image block. I believe I want to fully remove the “Image Dimensions”.
This repo which (I found here) does the job very well, but requires a new custom block, and placing an image in that block. The solution works, but is a tad clunky. I would like to disable these inputs by altering the core/image block.
The post referenced above @czapla says, ” … the
core/image
block currently has a technical limitation which prevents the user from removing the “Image Dimensions” using theblocks.registerBlockType
filter. I will fix it in the Gutenberg codebase …”It is possible the technical limitation still exists. I’ve tried every way I can think of, to disable the “Image Dimensions” using both blocks.registerBlockType and blocks.getBlockAttributes but neither seem to work. I was working with
"attributes": {
"allowResize": {
"type": "boolean",
"default": false
}
},and
"providesContext": {
"allowResize": "allowResize"
}per the repo and the working plugin in attempt to modify the core/image block.
Then, I found this documentation which says:
isResizable
A boolean control for showing the resize fields “Image Dimensions”. Set this to false if you want images to always be the fixed size of the selected image.
I tried setting isResizable to false, but to no avail. I suspect I am doing something wrong.
Any help would be appreciated.
- You must be logged in to reply to this topic.