0

If I drop an image file into the TinyMCE editor the drop event in the DOM contains the file in the DataTransferItemList object in the event. I wish to resize this image before it is dropped but I can't see how to do that if the DataTransferItemList is not writable for the drop event as stated here - https://developer.mozilla.org/en-US/docs/Web/API/DataTransferItemList/clear

Which means that I cannot do something like this as it will not replace the item at 0.

editor.ondrop = function(event) {
   event.dataTransfer.items[0] = resizeImageFunction(event.dataTransfer.items[0].getAsFile());
}

How would I be able to change the image before it is dropped into the editor?

Ikim SS
  • 123
  • 1
  • 5
  • It might help to show your implementation as a [functional demo](https://stackoverflow.com/help/minimal-reproducible-example). This could be informative: [HTML5 Pre-resize images before uploading](https://stackoverflow.com/questions/10333971/html5-pre-resize-images-before-uploading). – showdev Aug 17 '21 at 02:26

0 Answers0