我已经安装并可以使用tinyMCE 5,并且可以像在图像2中一样工作,并且可以自定义图像上传,在图像1中,内联工具栏快捷方式存在问题,我希望停用此工具栏。如果失败了,我怎么能像上面的图2一样上传这个插入图,而不是作为base64编码图。
1. Image Upload Working 2. Inline toolbar for insert image and table
所有这些工作,除了内联工具栏,有关删除它的任何建议。
我的代码
tinymce.init({
selector: 'textarea.tinymce',
plugins: 'print preview fullpage searchreplace autolink autosave save directionality visualblocks visualchars fullscreen image link media codesample table charmap hr pagebreak nonbreaking anchor toc insertdatetime advlist lists wordcount imagetools textpattern noneditable help charmap quickbars emoticons',
menubar: 'file edit view insert format tools table help',
toolbar: 'undo redo | bold italic underline strikethrough | fontselect fontsizeselect formatselect | alignleft aligncenter alignright alignjustify | outdent indent | numlist bullist | forecolor backcolor casechange formatpainter removeformat | pagebreak | charmap emoticons | fullscreen preview save print | insertfile image media link anchor codesample | ltr rtl | showcomments addcomment',
image_advtab: true,
height: 500,
entity_encoding: "raw",
content_css: [
"//fonts.googleapis.com/css?family=Lato:300,300i,400,400i"
],
browser_spellcheck: true,
relative_urls : true,
forced_root_block : "p",
media_poster: false,
image_title: true,
automatic_uploads: false,
paste_data_images: false,
images_upload_url: '/uploads/',
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.location != 'string') {
failure('Invalid JSON: ' + xhr.responseText);
return;
}
success(json.location);
};
formData = new FormData();
formData.append('file', blobInfo.blob(), blobInfo.filename());
xhr.send(formData);
}
});