Created on 26 November 2024, 30 days ago

With Drupal 8.9, I get the following console JS error on all pages when aggregation is turned on:

" Uncaught ReferenceError: once is not defined"

This error blocks all other JS execution on the page. No error when aggregation is turned off. Only workaround I've found is to uninstall the module.

The error is with the last line of the following code:

// ---- Some event handlers for CKEditor ----.

function keydown(e) {
if ((e.data.$.keyCode === 83) && (e.data.$.ctrlKey || e.data.$.metaKey)) {
e.data.preventDefault();
clickOnSubmitButton();
}
}

function keyup(e) {
if (e.data.$.keyCode === 83) {
clickAllowed = true;
}
}

function contentDom(e) {
let editable = e.editor.editable();
editable.attachListener(editable, 'keydown', keydown);
editable.attachListener(editable, 'keyup', keyup);
}

function instanceCreated(e) {
e.editor.on('contentDom', contentDom);
}

// If CKEditor is present on the page then also attach keyboard events
// listeners to it. Because if it gains focus then the document will not
// capture the events.
if (window.CKEDITOR) {
window.CKEDITOR.on('instanceCreated', instanceCreated);
}
}
};
}
)(Drupal, once);

🐛 Bug report
Status

Active

Version

2.0

Component

Code

Created by

🇨🇦Canada jglynn

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024