diff --git a/core/modules/ckeditor5/js/ckeditor5.es6.js b/core/modules/ckeditor5/js/ckeditor5.es6.js index 3ced334c3a..afa75d11bd 100644 --- a/core/modules/ckeditor5/js/ckeditor5.es6.js +++ b/core/modules/ckeditor5/js/ckeditor5.es6.js @@ -4,6 +4,13 @@ */ /* global CKEditor5 */ ((Drupal, debounce, CKEditor5, $, once) => { + // CKEditor 5 is incompatible with IE11. When IE11 is detected, the CKEditor5 + // variable is null. In those instances, exit early since CKEditor 5 is not + // loaded. + if (!CKEditor5) { + return; + } + /** * The CKEDITOR instances. * diff --git a/core/modules/ckeditor5/js/ckeditor5.js b/core/modules/ckeditor5/js/ckeditor5.js index 81a94cd2f3..29e8f0adb4 100644 --- a/core/modules/ckeditor5/js/ckeditor5.js +++ b/core/modules/ckeditor5/js/ckeditor5.js @@ -34,6 +34,10 @@ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToAr function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } (function (Drupal, debounce, CKEditor5, $, once) { + if (!CKEditor5) { + return; + } + Drupal.CKEditor5Instances = new Map(); var callbacks = new Map(); var required = new Set(); diff --git a/core/modules/ckeditor5/js/ie11.user.warnings.es6.js b/core/modules/ckeditor5/js/ie11.user.warnings.es6.js index c28a16a35a..6879f077a0 100644 --- a/core/modules/ckeditor5/js/ie11.user.warnings.es6.js +++ b/core/modules/ckeditor5/js/ie11.user.warnings.es6.js @@ -14,6 +14,11 @@ // created. Features such as Quick Edit that require the presence of a // Drupal.editors.ckeditor5, even for fields that do not use CKEditor 5. if (isIE11) { + // Explicitly set the global CKEditor5 object to null. This ensures code + // expecting the existence of the object does not fail, but is easily + // distinguishable from a valid CKEditor5 object. + window.CKEditor5 = null; + // This will reference a MutationObserver used by several functions in // Drupal.editors.ckeditor5. It is declared here and not the editor object // in order to work with IE11 object scope. diff --git a/core/modules/ckeditor5/js/ie11.user.warnings.js b/core/modules/ckeditor5/js/ie11.user.warnings.js index 2dbf1ff204..ad8988ffc0 100644 --- a/core/modules/ckeditor5/js/ie11.user.warnings.js +++ b/core/modules/ckeditor5/js/ie11.user.warnings.js @@ -9,6 +9,7 @@ var isIE11 = Modernizr.mq('(-ms-high-contrast: active), (-ms-high-contrast: none)'); if (isIE11) { + window.CKEditor5 = null; var quickEditLabelObserver = null; Drupal.editors.ckeditor5 = { attach: function attach(element) {