23

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!

2 Answers 2

54
+100

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
});
8
  • Of course... its always a simple 1 liner like that with tiny MCE, but I can never find anything in their docs. Can you please provide a link to that feature in the docs?
    – chiliNUT
    Commented Feb 3, 2014 at 14:44
  • 3
    Sure! here it is: tinymce.com/wiki.php/Configuration:paste_data_images Commented Feb 3, 2014 at 14:46
  • 1
    Btw, I've made some research to find it! Commented Feb 3, 2014 at 14:46
  • Awesome! You've just helped me out a lot. Thanks!
    – chiliNUT
    Commented Feb 3, 2014 at 14:50
  • 3
    Thanks! Saved me a bunch of time. I've setup a fiddle with TinyMCE 4.2 if anyone wishes to experiment jsfiddle.net/nisanth074/uyc6yxzc
    – nisanth074
    Commented Oct 13, 2015 at 11:21
11

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,
});
1
  • 3
    Thanks for pointing out the necessary paste plugin to be added, only now it works.
    – Avatar
    Commented Jul 10, 2017 at 22:02

Not the answer you're looking for? Browse other questions tagged or ask your own question.