Contribution Date
Technology
Contribution Project
Contribution Details
If it helps anyone this is my workaround for this which is more intuitive to end-user as we do not have to click on Source first and then save.:
var origBeforeSubmit = Drupal.Ajax.prototype.beforeSubmit;
Drupal.Ajax.prototype.beforeSubmit = function (formValues, element, options) {
if (typeof(CKEDITOR) !== 'undefined' && CKEDITOR.instances) {
const instances = Object.values(CKEDITOR.instances);
instances.forEach(editor => {
formValues.forEach(formField => {
// Get field name from the id in the editor so that it covers all
// fields using ckeditor.
let fieldName = document.querySelector(`#${editor.name}`).getAttribute('name');
if (formField.name === fieldName && editor.mode === 'source') {
formField.value = editor.getData();
}
});
});
}
origBeforeSubmit.call(formValues, element, options);
};
Issue Status
Active
Contribution Issue Link
Contribution Link
Files count
0
Patches count
0