diff --git a/core/modules/ckeditor/js/ckeditor.js b/core/modules/ckeditor/js/ckeditor.js index 17477e5..3fb3211 100644 --- a/core/modules/ckeditor/js/ckeditor.js +++ b/core/modules/ckeditor/js/ckeditor.js @@ -25,8 +25,17 @@ if (trigger === 'serialize') { 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;