Problem/Motivation

I would like to prevent a content author from resizing a media item below or above certain widths when using the resizing handles in CKEditor5. It would be beneficial if these values could be set either via configuration or in the CMS via a settings form.

Steps to reproduce

Images can be resized to very large sizes, e.g. 3000+ pixels in width, by dragging the resizing handle over to the right.

Proposed resolution

Prevent the user from resizing to extremes with a set minimum and maximum pixel width, provided through configuration or settings forms.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

nessthehero created an issue. See original summary.

drpldrp made their first commit to this issue’s fork.

drpldrp’s picture

damienmckenna’s picture

Status: Active » Needs review

Thank you for the merge request.

damienmckenna’s picture

Status: Needs review » Needs work

This looks really good, thank you.

I think there should be some protection around the min_width and max_width values, so that if invalid values are added they are ignored.

damienmckenna’s picture

julien_capybara worked on a similar issue that only enforced a maximum size: #3507466: Resized media max width

damienmckenna’s picture

Version: 1.0.x-dev » 1.1.x-dev