5

On our drupal 7 site, we have CKEditor installed. It works fine when creating new content, but it doesn't activate properly when you go to edit the same page later. It acts like there is no editor installed and just gives a standard textbox with source.

If I click "Edit Summary", it will usually show up for the summary textbox (though not always).

Why isn't CKEditor showing up for the Body textbox?

Note that I am not selecting "switch to plain text editor". If I do, and if I see CKEditor on "Edit Summary", then clicking "switch to plain text editor" does properly hide the CKEditor for the Summary textfield. Clicking "switch to rich text editor" also restores CKEditor for the Summary, but the main Body textbox still acts like it uses a plain text editor.

New Page - CKEditor Showing

ckeditor showing


Edit Page - CKEditor Missing

ckeditor missing


Edit Page Summary - CKEditor Showing (but still missing for the body textbox - not shown in screenshot)

ckeditor showing for summary


Edit: More details on the exact problem I found that the reason a New Page loads ckeditor, while editing does not, is because the textbox is empty. If I add text to the new page, switch to 'plain text editor', then try to switch back to 'rich text editor', then CKEditor does not load.

Similarly, if I clear out the data in the textbox while editing a page, and switch text editors, CKEditor loads up.

There is a 500 error being returned, causing CKEditor to not load. When there is text, switching to 'rich text editor' causes an AJAX call to the server to validate or otherwise process the textbox data. Since it fails, CKEditor never loads.

But if there is nothing in the textbox, the AJAX call never happens (and thus no 500 is returned), so CKEditor loads up just fine. This is also why CKEditor loads in the Summary: it has no data.

4
  • I have exactly the same problem. and I have searched for answers for many days now, and followed every solution that forums brougth me. I uninstalled wysiwyg and ckeditor, reinstalled ckeditor. No solution at all. My provider upgraded php versions (5.3 to 5.4) on the webserver. Can that be the source of the problem?
    – user19345
    Commented Jul 18, 2013 at 16:00
  • 2
    What is the input format set to? Your screenshot is cropping it out. Also, any errors in your javascript console? Commented Jul 19, 2013 at 17:26
  • @CharlieS The input format doesn't matter. Changing from "Full HTML" to "Filtered HTML" or any other resulted in the same problem.
    – Stephen S
    Commented Jul 19, 2013 at 17:33
  • 1
    @CharlieS I did have a javascript error, which I mentioned in my edit. Firebug showed a 500 being returned when calling mysite.com/ckeditor/xss.
    – Stephen S
    Commented Jul 19, 2013 at 17:34

7 Answers 7

4

The solution, in my situation, was two-fold.

Multiple CKEditor versions in different locations

First, the main reason was due to having multiple versions of CKEditor installed in different locations.

When you install the CKEditor module, you must also download the actual CKEditor code separately. It can be installed within the modules/ckeditor folder or in libraries. I had updated the module as well as the code, but the old version persisted in the libraries folder. Sometimes CKEditor would load, and other times it wouldn't. Likely it was due to one CKEditor library loading first.

Removing all duplicate references and clearing the cache worked. CKEditor loaded again on most of our sub-sites.

Buggy code on server causing a 500 error

The second problem was due to faulty php code on one of our subsites. For some reason, an unrelated page included other PHP and was somehow being called when CKEditor made the AJAX call to the server. The server responded with a 500 error, and the error logs shows that this unrelated page was somehow being called and failing.

I took out the reference to the buggy code, and CKEditor worked again for that page.

I still have no idea how that code was being called. It was a simple page with a single line of php, including a different file. Yet CKEditor failed to load on every page within the subsite, not just that page. I chalk it up to lacking enough understanding of Drupal internals.

1
  • I am encountering a similar issue with ckeditor. But when I view the console also find the same chosen errors Commented Sep 4, 2014 at 16:56
2

I had the same issue, ckeditor worked when creating new content but not when editing.

Doing a code inspect showed couple of chosen module errors (7.x-2.0-beta4)

Failed to load resource: the server responded with a status of 404 (Not Found) http://example.com/sites/all/libraries/chosen/chosen.jquery.min.js?v=1.1.0

Attr.specified is deprecated. Its value is always true. jquery.js?v=1.4.4:52

Uncaught TypeError: undefined is not a function chosen.js?v=1.1.0:60

My issue was I had extracted the Chosen.tar.gz file which doesnt have the .js file, you need the chosen.zip code in your libraries.

1
  • 1
    Yep broken chosen script. The knock-on effect to ckeditor is a surprice Commented Sep 4, 2014 at 17:36
2

Another thing that might cause this behaviour is having php code in the nodes, for example redirects performed with php code in the body field. If this is the case, you should use an external redirects module, because using php redirects in node fields will only cause trouble.

The issue seems to be also active in the module's issues queue.

1

I fixed this issue by following bellow steps:

Go to Content type -> Basic page -> Manage fields -> body

Now select "Plain Text" under "Text processing" then save. Again I changed from "Plain text" to "Filtered Text". Now its working.

I think here main concept is just clicking "Save" button

1

Thanks for this. I had the same problem where my editor wasn't showing up on the node forms and neither was my chosen. Looking in firebug console I could see JS errors relating to some JS I was adding in with the following hook:

function module_page_build($page) {
  $node = menu_get_object();
  if ($node) {
    drupal_add_js(drupal_get_path('module', 'module') .'/some-js.js');
  }
}

My check for $node is obviously not enough as this is true on the node edit forms. My solution will be to add some extra checks here. Maybe just using is_admin().

1

I resolved this using the following;

I initially had the Default and Alternate jQuery settings @ 1.10 and no CKEditor in Full or Filtered.

Drupal 7.32

Bootstrap 7.x-3.0

CKEditor Module 7.x-1.16

  • No special settings

jQuery update Module 7.x-2.4

  • Default jQuery version 1.8
  • Alternate jQuery version 1.8
  • jQuery and jQuery UI CDN = jQuery, google or MS

Dropping to 1.8 was the trick. shrug ... I don't know where to find the version I've got installed. :-)

Granitize me!

0

I had this happen on some nodes but not others; the problem was a 403 error being triggered on some pages with the ajax call to /ckeditor/xss ... mod_security was throwing the 403 error because of the content in the post. In my particular case, it was because of javascript snippets in the page content (widget loaders and sizers, etc), but it can be triggered by other things.

As a workaround, I could cut the content from the field, toggle to WYSIWYG mode, and then CKEditor would load. Then I could toggle the "Source" button on CKEditor, and paste the code back in, then toggle back into WYSIWYG mode and edit as normal, and save. Upon editing the next time, would have to do this again.

I think one solution could be to exclude the path /ckeditor/xss from mod_security filtering ... definitely don't disable mod_security altogether though, except for troubleshooting this issue.

Some other causes for this issue and workarounds are discussed here: https://www.drupal.org/node/2069871 ... thanks to "75th Trombone" on drupal.org for the suggestion about mod_security, which proved to be the cause in my case as well.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.