Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

tinyMCE can no longer drag and drop images after upgrading from version 3 to version 4

Tags:

My website was using the version 3 of tiny mce. One feature it had was that a user could drag an image into the editor, and it would automatically convert it to a base64 data-uri and insert it into the editor. I have just upgraded to version 4, and this functionality seems to be completely gone.

AFAIK, it was not a plugin or anything controlling this, just part of the default functionality, because I was still able to do it when initializing with minimal options, like this:

  tinyMCE.init({mode: "none"});   tinyMCE.execCommand('mceAddControl', false, 'selector'); 

Was this feature removed from version 4, or is there a way to turn it back on?

I really want to upgrade to 4, but this is the only thing stopping me, as the image feature is crucial for my application.

Thanks!

like image 659
chiliNUT Avatar asked Jan 13 '14 01:01

chiliNUT


2 Answers

If you want to enable the image drag & drop feature you have to do it explicitly with the code below.

tinymce.init({     ...     paste_data_images: true }); 
like image 91
Christophe Eblé Avatar answered Dec 08 '22 08:12

Christophe Eblé


You have to add following property to enable drag and drop

tinymce.init({             selector: "#imgedit",  // change this value according to your HTML             plugins: "paste",             menubar: "edit",             toolbar: "paste",             paste_data_images: true }); 

and if you want to add drag and drop with insert url of image functionality then add below line of code

tinymce.init({             selector: "#imgedit",  // change this value according to your HTML             toolbar: "image,paste",             plugins: "image,paste",             menubar: "insert,edit",             paste_data_images: true, }); 
like image 23
apifeez Avatar answered Dec 08 '22 07:12

apifeez