Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 295991

Enabling the upload of SVG images.

$
0
0

A far as I understood things, as from Drupal 10.3 onwards, we are should be able to upload SVG images in the CKEditor 5 as long as we implement the following hook...

/**
 * Drupal 10.3+: Enable upload of SVGs and WebP images in the CKEditor.
 */

function MY_MODULE_ckeditor5_plugin_info_alter(array &$plugin_definitions): void {
  $image_upload_plugin_definition = $plugin_definitions['ckeditor5_imageUpload']->toArray();
  $image_upload_plugin_definition['ckeditor5']['config']['image']['upload']['types'][] = 'webp';
  $image_upload_plugin_definition['ckeditor5']['config']['image']['upload']['types'][] = 'svg';
  $plugin_definitions['ckeditor5_imageUpload'] = new CKEditor5PluginDefinition($image_upload_plugin_definition);
}

However, when I implement it exactly as above, it does indeed add .webp files to the available types but does not add .svg filetype.

Is there another step I need to do?

Thanks all.


Viewing all articles
Browse latest Browse all 295991

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>