I want to embed an image into the tinymce editor but not the file, I want to embed it with this form (put its base64 data directly)
<img src="data:image/png;base64,ABCD..."></img>
I store the image data in a variable,
var data= '<img src="data:image/png;base64,ABCD..."></img>';
When I invoke
tinyMCE.execCommand('mceInsertContent', false, data);
or
tinyMCE.execCommand('mceInsertRawHTML', false, data);
or
tinyMCE.activeEditor.setContent(data, {format:'raw'});
after invoking, when I get the HTML back, we have:
<img src="blob:XYZ">
but the blob content is not same as the data we provide, it is very short and we can not see the image if we reuse this HTML in another browser. TinyMCE uses this BLOB:.. for caching, but I do not want any caching.
try to setup this confifguration
tinymce.init({
paste_data_images: true
});
https://www.tiny.cloud/docs/plugins/paste/#paste_data_images
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With