当我在tinymce编辑器中上传带有复制粘贴的图像时,我遇到了问题。
我得到这样的东西:
[img]data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAA/gAAADsCAYAAADAdA2HAAAgAElEQVR4Ae3dDXBd1X0g8L+xEeBaQEQc8xFsTDPrVGNcOihWa7BTUFrsZAvNtsLehYEJnWHN7jhuGNEs9GOnbdYUrGkhnnZdmrIDNbtgZUugm5XZjUhiL+7IKE1wjBJnSBwb4mIcXMCOjWUb79z3IT1JT7Kk+6R3Zf8049F9995z7v/8zn3P+t977nlTTp48eTLG+PPugQNxfl3dGEsr....
但是我想要的是<img src ="data:image/png; base64....... />
任何建议我该如何实现?
这是我的设置:
tinymceFunction() {
tinymce.init({
relative_urls: false,
document_base_url: window.location.protocol + '//' + window.location.host + '/' + window.location.pathname.split('/')[1],
skin_url: 'assets/skins/lightgray',
paste_data_images: true,
menubar: true,
statusbar: false,
selector: '#' + this.elementId,
branding: false,
plugins: ['link', 'table', 'autoresize', 'code', 'bbcode', "image paste"],
toolbar: 'undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link',
autoresize_min_height: 50,
autoresize_max_height: 300,
setup: (editor: any) => {
this.editor = editor;
editor.on('keyup change', () => {
const content = editor.getContent();
this.onEditorContentChange.emit(content);
});
},
images_dataimg_filter: function (img) {
return img.hasAttribute('internal-blob');
}
});
答案 0 :(得分:0)
您正在加载bbcode
插件:https://www.tiny.cloud/docs/plugins/bbcode/
该插件将使TinyMCE向您返回bbcode而不是HTML。如果您想要HTML,则可以删除bbcode
插件。