TinyMCE를 WYSIWYG 편집기로 사용하려고합니다. 내 서버에 이미지를 업로드 할 때, 나는 내용의 오류 :TinyMCE uploadImages() 함수가 작동하지 않습니다.
재산 'uploadImages'정의되지 않은
나는 정확한 문서를 읽는 오전,하지만 일부를 읽을 수 없습니다 이유는 기능을 인식하지 못하기 때문입니다. 여기에 내 코드입니다 :
<!DOCTYPE html>
<html>
<head>
<link href="resources/css/index.css" rel="stylesheet" type="text/css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://cloud.tinymce.com/stable/tinymce.min.js"></script>
</head>
<body>
<div id="container">
<form>
<label>Title</label>
<input type="text" name="title">
<label>Description</label>
<input type="text" name="desct">
<textarea id="editor"></textarea>
<input type="submit">
</form>
</div>
</body>
<script>
tinymce.init({
selector: '#editor',
theme: 'modern',
browser_spellcheck: true,
height: 480,
images_upload_url: 'resources/scripts/postAcceptor.php',
images_upload_base_path: '/tutorials/resources/images/',
images_upload_handler: function (blobInfo, success, failure) {
this.activeEditor.uploadImages(function(success) {
$.post('resources/scripts/postAcceptor.php', this.activeEditor.getContent()).done(function() {
console.log("Uploaded images and posted content as an ajax request.");
});
});
},
plugins: [
'advlist autolink link code image lists charmap print preview hr anchor pagebreak spellchecker',
'searchreplace wordcount visualblocks visualchars code fullscreen insertdatetime media nonbreaking',
'save table contextmenu directionality emoticons template paste textcolor'
],
toolbar: 'insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image | print preview media fullpage | forecolor backcolor emoticons | fontselect'
});
</script>
</html>
이렇게하려고합니다 : https://www.tinymce.com/docs/get-started/upload-images/ uploadImages() 함수가 작동하지 않습니다. 조금도. 나는 사용자가 업로드 한 이미지를 서버에 보내려하고있다. – user2896120
@ user2896120 오, 알 겠지만, 예제에서는 JSON 구성을 통해 확인하지 못했지만 모든 것이 바깥에있는 것처럼 보입니다. 그는'tinymce.activeEditor.uploadImages' 메소드에 함수를 보낸다. – Frankusky