TinyMCE 内联工具栏插入图像问题
TinyMCE inline toolbar insert image issue
我已经安装了 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);
}
});
负责左侧内联弹出窗口的插件名为 quickbars。您所要做的就是将其从配置对象中启用的插件列表中删除。
我已经安装了 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);
}
});
负责左侧内联弹出窗口的插件名为 quickbars。您所要做的就是将其从配置对象中启用的插件列表中删除。