I want to add max-width:’100%’ style to uploaded image. How can I do this?
file_picker_callback(cb, value, meta) {
const input = document.createElement('input');
input.setAttribute('type', 'file');
input.setAttribute('accept', 'image/*');
input.onchange = () => {
const file = input.files[0];
const reader = new FileReader();
reader.onload = () => {
const id = 'blobid' + new Date().getTime();
const blobCache = tinymce.activeEditor.editorUpload.blobCache;
const base64 = (<string>reader.result).split(',')[1];
const blobInfo = blobCache.create(id, file, base64);
blobCache.add(blobInfo);
cb(blobInfo.blobUri(), { title: file.name });
};
reader.readAsDataURL(file);
};
input.click();
},
I use this code to upload image on tinyMce.init.