GetmeUK / ContentTools

A JS library for building WYSIWYG editors for HTML content.
http://getcontenttools.com
MIT License
3.95k stars 395 forks source link

On Paste trigger insert Image #421

Closed Beludo closed 7 years ago

Beludo commented 7 years ago

Hello,

I wanted to ask if there is any way when we paste a image from the clipboard, if it is possible to trigger the select image of the input file with the data url of the image pasted?

anthonyjb commented 7 years ago

Hi @Beludo,

It's certainly possible though it would require a completely different approach to the ImageUploadHandler, at the moment the example handlers are designed to call a remote interface (URL endpoints via HTTP).

The image dialog tool provided by the base ContentTools editor just calls triggers various events which the image handler listens and reacts to so if you used a library designed to handle data URL images (of which I believe there are many) to manage image upload and transformation within your image handler code it should just work. Effectively Instead of setting a remote URL in the image dialog you simply be setting a data URL.

Ant