Reputation: 11
I want to get the content written by Editer5 and submit it to save,but only text information can be obtained, and the content of the picture can not be obtained. this is my code
Upvotes: 0
Views: 1909
Reputation: 2445
You assign created editor instance to a variable and then use the getData function. You can use .then
on editor creation and assign it there:
var myEditor;
ClassicEditor
.create( document.querySelector( '#editor' ) )
.then( editor => {
console.log( 'Editor was initialized', editor );
myEditor = editor;
} )
.catch( err => {
console.error( err.stack );
} );
and then get data using myEditor.getData();
Please also have a look at: https://docs.ckeditor.com/ckeditor5/latest/framework/guides/ui/document-editor.html#the-editor
Upvotes: 1