JS error CKEDITOR is not defined

Created on 20 May 2022, over 2 years ago
Updated 13 October 2023, about 1 year ago

Problem/Motivation

When you auto save a form without a WYSIWYG/CKEDITOR field you get a JS error in the console in Chrome that says the CKEDITOR is not defined.

Uncaught ReferenceError: CKEDITOR is not defined
    at Object.attach (auto-save-form.js?v=1.x:13:30)
    at drupal.js?v=9.3.12:27:24
    at Array.forEach (<anonymous>)
    at Object.Drupal.attachBehaviors (drupal.js?v=9.3.12:24:34)
    at drupal.init.js?v=9.3.12:29:12
    at HTMLDocument.listener (drupal.init.js?v=9.3.12:17:7)

Steps to reproduce

  1. Add a fromID of a form with a WYSIWYG/CKEDITOR field to /admin/config/content/autosaveformsid
  2. Go to the page where the form is shown
  3. Open your Chrome DevTools and see the JS error in the Console

Proposed resolution

Add an if statement around the CKEDITOR.instances for loop to check if CKEDITOR is defined.

Remaining tasks

None

User interface changes

None

API changes

None

Data model changes

None

I added the proposed resolution in the attached patch.

🐛 Bug report
Status

Needs review

Version

5.1

Component

Code

Created by

🇳🇱Netherlands laarrrx

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024