nshenderov / strapi-plugin-ckeditor

Integrates CKEditor 5 into your Strapi project as a fully customizable custom field. (Unofficial integration)
https://www.npmjs.com/package/@_sh/strapi-plugin-ckeditor
MIT License
84 stars 53 forks source link

Image width and height are undefined #134

Closed iwap closed 4 months ago

iwap commented 5 months ago

Describe the bug

The width and height attribute of images is undefined:

<img src=\"<src-path>\" alt=\"<alt-text>\" srcset=\"<src-set>\" sizes=\"100vw\" width=\"undefined\" height=\"undefined\">

To Reproduce Steps to reproduce the behavior:

  1. Add an image from the media library into the CKEditor
  2. Save the entity
  3. Look at the API response

Expected behavior

Receive the width and height of the image in the API response

iwap commented 5 months ago

I've also tried using the other CKEditor plugin: https://github.com/ckeditor/strapi-plugin-ckeditor/, however I prefer this one as it allows a lot more customisation. The other plugin sends undefined as well if you just add the image, however once you change alignment of the image it start reporting the width and height properties. This plugin still reports undefined if you change alignment or resize the image however (it does report a resize %). Perhaps this helps to find the issue (or if this plugin relies on some of their code you could pass on an issue report to them). Having the width and height attributes available would be useful to be able to optimise the images when using them in a NextJS setup (parsing the html and loading the images into a <Image> component).