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.
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.
Share Improve this question asked Jul 21, 2017 at 7:54 benchpresserbenchpresser 2,1882 gold badges26 silver badges42 bronze badges 2- 1 It you use TinyMCE APIs to get content back out of the editor it should be the original Base64 version ... is that not what you get when you submit the form that contains the TinyMCE content? – Michael Fromin Commented Jul 21, 2017 at 18:56
- Thanks, we found the problem, when we get the content we used getConent ({raw}) variation which caused base64 data to be convertd to blobs. If we called getContent(), we get the base64 data. – benchpresser Commented Jul 24, 2017 at 15:08
1 Answer
Reset to default 5try to setup this confifguration
tinymce.init({
paste_data_images: true
});
https://www.tiny.cloud/docs/plugins/paste/#paste_data_images
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744191480a4562454.html
评论列表(0条)