Can someone help me with integrating CKEditor and inserting HTML tag of a clicked image into the editor? I've tried different solutions but haven't been successful. I understand that doing this directly in CKEditor may not be secure.
This is a Vue.js component
<div class="emoji">
<img @click="sendEmoji($event)" src="/assets/images/facebook/expressionless-face_1f611.png" alt="emoji">
</div>
<textarea id="comment_editor"></textarea>
<script>
export default {
mounted() {
ClassicEditor
.create( document.querySelector( '#comment_editor' ), {
toolbar: {
items: [
'bold',
'italic',
'underline',
'link',
'fontColor',
'fontSize',
'fontFamily',
'codeBlock',
'specialCharacters',
'superscript',
'subscript',
]
},
language: 'ru',
licenseKey: '',
} )
.then( comment_editor => {
window.comment_editor = comment_editor;
} )
.catch( error => {
console.error( 'Oops, something gone wrong!' );
console.error( 'Please, report the following error in the https://github.com/ckeditor/ckeditor5 with the build id and the error stack trace:' );
console.warn( 'Build id: 1elt9gdr81je-u3jmkfuwv026' );
console.error( error );
} );
},
methods: {
sendEmoji: function(event){
let img = event.target.outerHTML;
console.log(img);
window.comment_editor.setData(img)
console.log(window.comment_editor.getData());
},
}
}