You can check the editor height inside the change
event and see if the height has changed.
Please run the below snippet and check the console:
let editorWidth;
let editorHeight;
ClassicEditor
.create(document.querySelector('#Comment'), {
toolbar: [ 'heading', '|', 'bold', 'italic', 'blockQuote' ],
})
.then(editor => {
editor.model.document.on('change', (eventInfo, name, value, oldValue) => {
const newWidth = editor.ui.view.element.offsetWidth;
const newHeight = editor.ui.view.element.offsetHeight;
if(editorWidth !== newWidth || editorHeight !== newHeight) {
console.log('Editor size changed. New size:', newWidth, newHeight);
editorWidth = newWidth;
editorHeight = newHeight;
}
});
})
.catch(error => {
console.error(error);
});
<script src="https://cdn.ckeditor.com/ckeditor5/17.0.0/classic/ckeditor.js"></script>
<div id="Comment"></div>