Fixes an error when saving a plaintext textarea field when CKEditor is loaded and there are no textareas it initialized. (#2084)

Fixes Issue with textarea fields, if ckeditor is loaded but there is not textarea with the class it has assigned.
This commit is contained in:
Christoph Schlaepfer authored and GitHub committed 2024-01-18 00:58:58 -08:00
1 parent 15c21afe64
commit a1625c07ea
1 file changed
+1 -1
@@ -150,7 +150,7 @@ globalThis.bb = {
const formData = new FormData(formElement);
// Get all CKEditor instances and replace the original textarea values with the updated content.
if (typeof editors !== "undefined" && Array.isArray(editors)) {
if (typeof editors !== "undefined" && Array.isArray(editors) && editors.length > 0) {
let editorContentOnRequiredAttr = false;
Object.keys(editors).forEach(function (name) {
editorContentOnRequiredAttr = editors[name].required