Do not load the smallest version of an image for media previews in CkEditor

Created on 17 July 2025, 19 days ago

Problem/Motivation

When using an image in CkEditor, by default the smallest version from the srcset is added as the image src. Since the JavaScript for responsive images doesn't work in CkEditor, the image doesn't properly resize based on the container. This means the smallest version of the image is always shown.

Steps to reproduce

  1. Install the module
  2. Configure a CkEditor with media library
  3. Add an image from the media library to CkEditor
  4. Observe the issue

Proposed resolution

Instead of loading the smallest version of the image, use the biggest version within CkEditor. We can detect media previews through the routes for media library or entity embed.
media.filter.preview and embed.preview

Remaining tasks

  1. Write a patch
  2. Review
  3. Commit

User interface changes

The media items in CkEditor will now longer show in their smallest size using the formatter.

API changes

None

Data model changes

None

Feature request
Status

Active

Version

1.4

Component

Code

Created by

🇳🇱Netherlands seanB Netherlands

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024