<script type="text/javascript"> // TinyMCE 6 初始化 - 系统后台版本 document.addEventListener('DOMContentLoaded', function() { function waitForTinyMCE() { if (typeof tinymce === 'undefined') { setTimeout(waitForTinyMCE, 100); return; } tinymce.init({ selector: '#art_content', language: 'zh_CN', height: 400, menubar: false, branding: false, plugins: [ 'advlist', 'autolink', 'lists', 'link', 'image', 'charmap', 'preview', 'searchreplace', 'visualblocks', 'code', 'fullscreen', 'insertdatetime', 'table', 'wordcount' ], toolbar: 'undo redo | formatselect | bold italic underline strikethrough | ' + 'alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | ' + 'link image table | code preview fullscreen | removeformat', content_style:
body { font-family: "微软雅黑", Arial, sans-serif; font-size: 14px; line-height: 1.6; color: #333; margin: 10px; } img { max-width: 100%; height: auto; } p { margin: 0 0 10px 0; } h1, h2, h3, h4, h5, h6 { margin: 20px 0 10px 0; font-weight: bold; } ,
// 图片上传配置 images_upload_url: 'upload.php?act=upload', images_upload_handler: function (blobInfo, success, failure) { const xhr = new XMLHttpRequest(); const formData = new FormData(); xhr.onload = function() { if (xhr.status < 200 || xhr.status >= 300) { failure('HTTP Error: ' + xhr.status); return; } try { const json = JSON.parse(xhr.responseText); if (json && json.location) { success(json.location); } else { failure('Invalid response'); } } catch (e) { failure('Invalid JSON response'); } }; formData.append('file', blobInfo.blob(), blobInfo.filename()); xhr.open('POST', 'upload.php?act=upload'); xhr.send(formData); }, setup: function(editor) { editor.on('init', function() { console.log('TinyMCE系统编辑器初始化完成'); }); } }); } waitForTinyMCE(); }); </script> 前后台发文章的时候添加图片报错Cannot read properties of undefined (reading 'then')