Problem/Motivation

When source editing an image inside CKEditor 5, when a user tries to add a width attribute, it does not resize the image.

Steps to reproduce

1. Edit a piece of content that has CKEditor 5 enabled
2. Add an image, then click the Source button in the CKEditor 5 toolbar
3. Add "width=30%" (or any size)
4. Click Source again (image does not change).

Proposed resolution

Either add functionality to Drupal core so it works without the dependency or add the CKEditor 5 resize plugin dependency with #3224652: [drupalImage] Add ckeditor5-image's imageresize plugin to allow image resizing.
(Source editing resizing works with the dependency)

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Comments

hooroomoo created an issue. See original summary.

hooroomoo’s picture

Issue summary: View changes
hooroomoo’s picture

Issue summary: View changes
hooroomoo’s picture

Issue summary: View changes
wim leers’s picture

Title: [drupalImage] Cannot change size of image through source editing » [drupalImage] <img width> not visible in editing view (because only for data downcast)
Issue tags: +Needs tests

I think this is because:

    conversion
      .for('downcast')
      .add(modelEntityUuidToDataAttribute())
      .add(modelEntityTypeToDataAttribute());

    conversion
      .for('dataDowncast')
…
      .add(modelImageWidthToAttribute())
      .add(modelImageHeightToAttribute())

i.e. the width and height downcasts are happening only for the dataDowncast, not for the editingDowncast. Moving those two to the catch-all/generic downcast would fix this.

wim leers’s picture

I don't know at which point this was fixed, but I definitely can no longer reproduce this 🥳 Lots of fixes/improvements happened, not sure if #3249592: [drupalImage] <img width> upcast assumes HTML5: px unit, but HTML4 allowed % unit or #3269868: [drupalImage] Some Image attributes are lost in edge cases where image upcasts into inline image is the one that fixed this, but it definitely is fixed 👍