3

I'm having a problem including a base64 image using tinymce.activeEditor.execCommand('mceInsertContent',

The following works:

tinymce.activeEditor.execCommand("mceInsertContent", true, "<img style = 'height:80px;width:80px' src='/Content/image.png' />");`

tinymce.activeEditor.execCommand("mceInsertContent", true, "<div>safasfdasfd</div>");

But when using tinymce.activeEditor.execCommand('mceInsertContent', true, img64);
where img64 is a base64 image received from a MVC partial view converted to string.

Does someone have a working example. I don't know if the syntax is wrong or if there is some option I have forgotten?

Update:

The following do not work:

tinymce.activeEditor.execCommand("mceInsertContent", true, "<img style='height:80px;width:80px' src='data:image/png;base64,/some long 64 string is here'>");

Does anyone know why this is not working? Some help would be greatly appreciated.

Nathan
  • 1,451
  • 1
  • 15
  • 28
asdfasdf
  • 211
  • 2
  • 4
  • 9

2 Answers2

4

It seems that others are having this problem as well. Until there is an official way to solve your problem, there is a workaround posted in this thread: https://github.com/buddyexpress/bdesk_photo/issues/2

UPDATE: Solution is to add paste_data_images : true to your configuration. See the docs here: http://www.tinymce.com/wiki.php/Configuration:paste_data_images

Nathan
  • 1,451
  • 1
  • 15
  • 28
  • I created a TinyMCE bug report for this. Vote for it here: http://www.tinymce.com/develop/bugtracker_view.php?id=7549 – Nathan Jun 10 '15 at 21:17
0

Try mceInsertRawHTML rather than mceInsertContent