0
votes

First of all, I am a beginner in tinymce and furthermore not an english native, so sorry for any mistakes ;)

I intend to upload local images (Base64) from multiple inline tinymce(v.4) editors on my site by pressing a button and running the function the tinymce website provides:

tinymce.activeEditor.uploadImages(function(success) {
  $.post('ajax/post.php', tinymce.activeEditor.getContent()).done(function() {
    console.log("Uploaded images and posted content as an ajax request.");
  });
});

So far it works wery well, but I still have a small problem: It only uploads images from the "active editor" (as stated in the code). If I add an image to an editor, than focus to another on the page and then run the function, it only uploads from the currently active editor, but not my previously added image.

How do I achieve that it uploads from ALL editors on the page?

Thanks in advance!

1

1 Answers

0
votes

TinyMCE already has a way to handle inserting local images and getting them to your server:

https://www.tinymce.com/docs/advanced/handle-async-image-uploads/

If you configure this on each editor when you init() the editor these things will get done properly across all editor instances.