偶然的你
您可以检查事件内的编辑器高度change,看看高度是否发生变化。请运行以下代码片段并检查控制台: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>