Tinymce image handler


#1

Hi there,

While i have the tinymce integrated and loading on the client side. I am stuck and need help in upload of image. Has anyone successfully managed to upload image and store in database via the tinymce wysiwyg editor. Snippets / solutions / examples would be appreciated.

Thanks

Regards
Shilpa


#2

I’m using TinyMCE too, and what I did instead was to have my own file uploader/gallery next to the editor, and use the dragstart event so that if you drag an image from the gallery to any text input, instead of giving just the url, which is the default, it gives an img tag.

const url = location.origin + (this.url({store:'resized',auth:false}) || this.url({store:'file',auth:false}))
event.dataTransfer.setData('text/html', '<img class="" src="' + url +'">')

Since the gallery only displays thumbnails, I use this.url(), which is a CollectionFS method to get a larger version of the image instead.

I don’t remember why I specified class="" :thinking: