ckeditor / ckeditor4

The best enterprise-grade WYSIWYG editor. Fully customizable with countless features and plugins.
https://ckeditor.com/ckeditor-4
Other
5.8k stars 2.48k forks source link

Dropping or copying from context menu images with data URI are processed as files #3568

Open msamsel opened 5 years ago

msamsel commented 5 years ago

Type of report

Bug

Provide detailed reproduction steps (if any)

Steps for Edge:

  1. Open test /tests/plugins/easyimage/manual/datauriimages or create sample with image with dataUri of type like image/svg+xml. Math type creates such images, you can use one created here: https://ckeditor.com/docs/ckeditor4/latest/examples/mathtype.html.
  2. Drag and drop the image to the editor in Edge.
  3. It looks like such images are processed as files during drag and drop on Edge. And there is no text/html clipboard data in this case.
  4. This results in changing the image format from svg to png.

Steps for Google Chrome & Firefox:

  1. Open test /tests/plugins/easyimage/manual/datauriimages or create sample with image with dataUri of type like image/svg+xml. Math type creates such images, you can use one created here: https://ckeditor.com/docs/ckeditor4/latest/examples/mathtype.html.
  2. Copy image with dataUri (in manual test is the image with the equation) with native context menu (right click -> copy image)
  3. Paste image in the editor
  4. This results in changing the image format from svg to png. issue1

Expected result

Image type won't change during drag and drop

Actual result

Image is transformed from svg to png

Other details

Issue extracted from #3524. The critical part which obtained the image from the file is located here: https://github.com/ckeditor/ckeditor4/blob/d74ddb7c05301a8f9cc7b03579685c68c40cc167/plugins/imagebase/plugin.js#L262-L299

f1ames commented 5 years ago

I started to wonder if we should treat it as a bug and if there are any use cases which breaks because of it :thinking:

Maybe for some plugins which explicitly uses/requires SVGs and there is an integration where you can drag/drop or copy/paste such files from external interface. But sound like an edge case TBH.

Dumluregn commented 4 years ago

Issue also occurs in IE11 during copying from context menu.