Problem/Motivation

In #3280279: Allow sites to programmatically opt in to accept more image type uploads in CKEditor 5: TIFF, SVG… we added hook_ckeditor5_image_controller_extensions_alter() to allow other modules to modify the list of allowed extensions for CKEditor5's image upload plugin.

WebP is officially adopted as an image type by Drupal core, so we need to add CKEditor5 support for it. See #3280279-26: Allow sites to programmatically opt in to accept more image type uploads in CKEditor 5: TIFF, SVG… for more information.

Proposed resolution

Update \Drupal\ckeditor5\Controller\CKEditor5ImageController::upload() to add webp as a valid file name extension.

Update core/modules/ckeditor5/ckeditor5.ckeditor5.yml -> ckeditor5_imageUpload -> ckeditor5 -> config -> image -> upload -> types to add webp as a valid IANA file type.

Remaining tasks

  1. Commit #3280279: Allow sites to programmatically opt in to accept more image type uploads in CKEditor 5: TIFF, SVG…
  2. Write a patch
  3. Review and feedback
  4. RTBC and feedback
  5. Commit

User interface changes

It is now possible to upload WebP images to CKEditor5 by dragging-and-dropping or using the image upload button.

API changes

None.

Data model changes

None.

Release notes snippet

Added CKEditor5 support for WebP images.

Issue fork drupal-3386605

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

mparker17 created an issue. See original summary.

g-brodiei made their first commit to this issue’s fork.

g-brodiei’s picture

Even though this issue is postponed, I ran into this request earlier today and needed a patch to allow ckeditor5 to work with uploading webp files.

I'm leaving this MR for the future when other dependent issues are resolved, or others who may need a quick fix to make use of this as a patch.

Tested with 10.1.x
Hope this helps, Thanks!

dave_______1’s picture

The above seems to work for webp and Drupal 10.1 without the patch linked but after an update to 10.2 it obviously reverted so had to be re-added.
Would be great to have webp, svg and avif in core fields and CKEditor.

wim leers’s picture

Title: [PP-1] Add CKEditor5 support for WebP images » [PP-1] Add CKEditor 5 support for WebP images
Version: 10.1.x-dev » 11.x-dev
Category: Task » Feature request
ankondrat4’s picture

StatusFileSize
new1.36 KB

Hello.
Added patch for Drupal core 10.2.6

nelo_drup’s picture

Add comatibility with Drupal 10.3.1

mreda’s picture

Adding a patch for Drupal 10.3

transmitter’s picture

I've just tried to apply the patch #9 in D11 but it didn't work:

  - Applying patches for drupal/core
    https://www.drupal.org/files/issues/2024-08-14/3386605-9-add-ckeditor5-support-for-webp.patch (Add CKEditor 5 support for WebP images 3386605)
   Could not apply patch! Skipping. The error was: Cannot apply patch https://www.drupal.org/files/issues/2024-08-14/3386605-9-add-ckeditor5-support-for-webp.patch

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.

quietone’s picture

Status: Postponed » Active

There is no indication here why this is postponed, so I am changing this to active.

quietone’s picture

Title: [PP-1] Add CKEditor 5 support for WebP images » Add CKEditor 5 support for WebP images
lionsea’s picture

I don't know this is an issue or not, but full WebP support including CKeditor's image upload button is always my concern.
I had no clue to activate full WebP support for CKeditor's image upload button, so only my solution is overwriting the core source code of ckeditor5.ckeditor5.yml. That works but I have to overwrite whenever update my core.

people who want to use WebP at Drupal11 search information at internet and would just found that Drupal11 fully supports WebP but they would never find how to activate it. So I suggest that Drupal core supports WebP by default or clearly document how to use WebP in the official documentation.