3

I have recently upgraded FCKEditor to the CKEditor module on a website powered by Drupal 6.

Some of the pages on the website have invalid (x)HTML, mainly block elements inside inline elements. Before anyone edits the page, the content is rendered live on the website as it should appear.

However when an admin goes to edit the page and the editable content appears in WYSIWYG view of CKEditor, it attempts to 'fix' the invalid code successfully.

My question is simply how to prevent CKEditor from re-writing the code in WYSIWYG view?

Here is example code: Should be / what I need:

<a class="link-block" href="index.html"><h2>My Header</h2><p>Some text.</p></a>

Result after editor save:

<h2><a class="link-block" href="index.html">My Header</a></h2><p><a class="link-block" href="index.html">Some text.</a></p>

Before I get scorned by anyone, I know code should be valid according to W3C specs however I didn't build the website and to re-code it all would be a monumental task.

Muhammad Reda
  • 26,379
  • 14
  • 93
  • 105
P3tro
  • 139
  • 1
  • 3
  • 9
  • Yes it's possible, but it would almost be professional suicide for anyone to advise you how to do it :) CKEditor/Drupal input filters go to great lengths to stop people entering **invalid** code...you obviously understand what the implications of this are and if you're a professional web developer you already know there's only one answer...edit the HTML until it's valid. – Clive Mar 13 '12 at 12:43
  • @Clive thanks for the comment. I figured it was possible to prevent the correction. I just need to know how. – P3tro Mar 13 '12 at 12:54
  • Go to "admin/settings/filters", click edit on the filters you want to remove the behaviour from, then untick the "HTML Corrector" filter and save. But you didn't hear that from me ;) – Clive Mar 13 '12 at 12:56
  • @Clive That setting is already unticked :( – P3tro Mar 13 '12 at 12:59
  • Are you using the CKEditor module directly or the WYSIWYG module with CKEditor as the chosen editor? – Clive Mar 13 '12 at 13:11
  • @Clive Pretty sure it's the CKEditor module directly but how can I check? Sorry, I'm no Drupal expert. – P3tro Mar 13 '12 at 14:02
  • You should be able to just edit the CKEditor profile and switch off the HTML Corrector for that too – Clive Mar 13 '12 at 14:06
  • @Clive Thanks, found that, but HTML corrector in the CKEditor profile is also unticked. Is this possibly a bug? – P3tro Mar 13 '12 at 16:12
  • I'm not sure what kind of goofball would scorn you for such a valid concern. If I have a content system, I simply want to inject the html content of my choice. If it's wildly invalid, that's my problem. You don't have to code to W3C specs either. It's your code, man! (disclaimer: It's a good idea to use sound, tested practices. It's just that when I am forced to do so, I become the hulk and smash things) – MrBoJangles Jul 01 '13 at 16:57

1 Answers1

1

if you are using FCEditor with wysiwyg module, go to YOURSITE/admin/config/content/wysiwyg/profile/full_html/edit, then open the section "Cleanup and output" and uncheck "Verify HTML" option.

Muhammad Reda
  • 26,379
  • 14
  • 93
  • 105