<script>
tinymce.init({
selector: 'textarea',
plugins: 'image code',
toolbar: 'undo redo | image code',
// without images_upload_url set, Upload tab won't show up
images_upload_url: '<?= base_url("upload.php"); ?>',
// override default upload handler to simulate successful upload
images_upload_handler: function (blobInfo, success, failure) {
var xhr, formData;
xhr = new XMLHttpRequest();
xhr.withCredentials = false;
xhr.open('POST', '<?= base_url("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);
},
});
</script>
//此代码无效
1条答案
按热度按时间6tqwzwtp1#
每个文件管理器都需要像ckeditor这样的任何文本编辑器你必须使用一个编辑器这个文件管理器有一个文档和安装你必须在主站点阅读它。您可以在此url中查看文档https://www.tinymce.com/docs/