如何在baseymce中包含base64图像

时间:2015-03-13 22:14:36

标签: tinymce

我遇到问题,包括使用tinymce.activeEditor.execCommand('mceInsertContent',

的base64图像

以下作品:

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

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

但使用tinymce.activeEditor.execCommand('mceInsertContent', true, img64);时 其中img64是从转换为字符串的MVC局部视图接收的base64图像。

有人有一个有效的例子。我不知道语法是否错误,或者我是否忘记了某些选项?

更新

以下不起作用:

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

有谁知道为什么这不起作用?一些帮助将不胜感激。

2 个答案:

答案 0 :(得分:2)

似乎其他人也遇到了这个问题。在有正式方法解决您的问题之前,此主题中有一个解决方法:https://github.com/buddyexpress/bdesk_photo/issues/2

更新:解决方案是将paste_data_images : true添加到您的配置中。 请参阅此处的文档:http://www.tinymce.com/wiki.php/Configuration:paste_data_images

答案 1 :(得分:0)

尝试mceInsertRawHTML而不是mceInsertContent

相关问题