diff --git a/core/modules/ckeditor/js/ckeditor.js b/core/modules/ckeditor/js/ckeditor.js index 313621f..5a4547b 100644 --- a/core/modules/ckeditor/js/ckeditor.js +++ b/core/modules/ckeditor/js/ckeditor.js @@ -60,8 +60,17 @@ editor.updateElement(); } else { - editor.destroy(); - element.removeAttribute('contentEditable'); + // Try to destroy the CKEditor instance; this may fail if the CKEditor + // instance hasn't finished initializing yet, because initializing is + // asynchronous (by necessity, because it needs to load plugins, which + // themselves may need to load more things etc). + try { + editor.destroy(); + element.removeAttribute('contentEditable'); + } + catch (e) { + // Empty. + } } } return !!editor;