gpt4 book ai didi

javascript - TinyMCE v4 关闭 blob

转载 作者:数据小太阳 更新时间:2023-10-29 06:05:08 24 4
gpt4 key购买 nike

我不想 tinymce 将 blob 用于小图像,因为我正在将那些 data:images 转换为真实图像并且我替换了 img src="" 在我有真实图像之后。我怎样才能让它只获取 data:image 图片?是否可以?我试过了

automatic_uploads: false

但它不会改变任何东西。

这是我的代码:

tinymce.init({
selector: strSelector + "textarea:not(#strDescription)",
paste_data_images: true,
image_advtab: true,
mode: "specific_textareas",
editor_selector: "mceEditor",
automatic_uploads: false,
file_picker_callback: function(callback, value, meta) {
if (meta.filetype == 'image') {
$('#upload').trigger('click');
$('#upload').on('change', function() {
var file = this.files[0];
var reader = new FileReader();
reader.onload = function(e) {
callback(e.target.result, {
alt: ''
});
};
reader.readAsDataURL(file);
});
}
},
plugins: [
"advlist autolink lists link image imagetools charmap preview anchor code",
"searchreplace visualblocks code fullscreen",
"insertdatetime table contextmenu paste imagetools"
],
setup: function(editor) {
editor.on('change', function() {
editor.save();
});
}
});

最佳答案

可以通过添加以下过滤器来禁用 Blob 转换:

TinyMCE docs: images_dataimg_filter

tinymce.init({
images_dataimg_filter: function(img) {
return img.hasAttribute('internal-blob');
}
});

关于javascript - TinyMCE v4 关闭 blob,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42998952/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com