ckeditor 5 DecoupledEditor or classic getData not working in function
I have a modal that once a button clicked it writes the HTML, then inits the ckeditor. However, after this code, there is another code that get triggered by a function once you submit the form that holds the ckeditor. If I do
my modal function once button is clicked `
var ckeditor;
ClassicEditor .create( document.querySelector( '#ckeditor' ) ) .then( newEditor => { ckeditor = newEditor; } ) .catch( error => { console.error( error ); } );
`
my other function once the submit is clicked ` if( form.form.attr( 'id' ).match( 'notes-update' ) ){
console.log( ckeditor );// this will shows <textarea id="ckeditor" style="display: none;"></textarea>
console.log( ckeditor.getData() ); // completely crashes with ckeditor.getData is not a function
}// if( form.form.attr( 'id' ).match( 'notes-update' ) )
`
✔️ Expected result
how can I get this working? it has to be because I am not initializing the ckeditor on load, but rather initializing when the modal loads. How do I then get the data from ckeditor from the submit function?
- Browser: brave
- OS: mac
There has been no activity on this issue for the past year. We've marked it as stale and will close it in 30 days. We understand it may still be relevant, so if you're interested in the solution, leave a comment or reaction under this issue.
We've closed your issue due to inactivity. We understand that the issue may still be relevant. If so, feel free to open a new one (and link this issue to it).