Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TinyMCE v4 turn off blobs

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.

Here is my code:

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();
        });
    }
});
like image 230
ElDiabolo Avatar asked Mar 24 '17 11:03

ElDiabolo


People also ask

How do you get rid of Tinyed by power on TinyMCE?

Use the branding option to disable the "Powered by Tiny" displayed in the status bar for product attribution.

How do I reinitialize TinyMCE?

Use tinymce. remove() method to remove TinyMCE editor from the HTML element and again call tinymce. init() on the selector to reinitialize.

How do you make TinyMCE editor readonly?

Use the checkbox to toggle between the "design" and "readonly" modes.


1 Answers

Blob conversion can be disabled by adding the filter below:

TinyMCE docs: images_dataimg_filter

tinymce.init({
   images_dataimg_filter: function(img) {
      return img.hasAttribute('internal-blob');
  }
});
like image 70
Sivabalan Avatar answered Sep 27 '22 19:09

Sivabalan