本文介绍了TinyMCE v4关闭Blob的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不想使用tinymce为微小的图像使用斑点,因为我将这些data:images转换为真实图像,并且在拥有真实图像后替换了img src="".我如何管理它仅获取data:image图片?是否有可能?我尝试过

I don't wanna tinymce to use blobs for tiny images, because I'm converting those data:images to real images and I´m replacing the img src="" after I have real images. How could I manage it to only get data:image images? Is it possible?I tried

automatic_uploads: false

但是它不会改变任何东西.

but it won't change anything.

这是我的代码:

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转换:

Blob conversion can be disabled by adding the filter below:

TinyMCE文档:images_dataimg_filter

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

这篇关于TinyMCE v4关闭Blob的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-27 11:35