*

rooman

  • ****
  • 231 posts
Insert images instead of links in tinymce
« on: October 18, 2022, 10:11:44 AM »
I made some modifications to the attached code
Unfortunately, the code only works with small images
Large images show an error The image is converted to code and only the code appears
But the problem is, I want to show the rest of the tools
When editing, it disappears and only the image button appears
Is the code correct?
Code: [Select]
tinymce.init({
selector : 'textarea#s_description',
plugins : 'image',
toolbar : 'image',
images_upload_url : 'upload.php',
automatic_uploads : false,
images_upload_handler : function(blobInfo, success, failure) {
var xhr, formData;
xhr = new XMLHttpRequest();
xhr.withCredentials = false;
xhr.open('POST', 'upload.php');
xhr.onload = function() {
var json;
if (xhr.status != 200) {
failure('HTTP Error: ' + xhr.status);
return;
}
json = JSON.parse(xhr.responseText);
if (!json || typeof json.file_path != 'string') {
failure('Invalid JSON: ' + xhr.responseText);
return;
}
success(json.file_path);
};
formData = new FormData();
formData.append('file', blobInfo.blob(), blobInfo.filename());
xhr.send(formData);
},
});
« Last Edit: October 18, 2022, 01:15:04 PM by rooman »

*

MB Themes

Re: Insert images instead of links in tinymce
« Reply #1 on: October 18, 2022, 02:33:45 PM »
Restore it from original source code
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots