Hello. I am using 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.
All HTML correction options are unticked in Drupal and CKEditor configuration using Drupal's admin. So, is this a bug?
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:
Result after switching to WYSIWYG view:
Browsers: Firefox, Safari, Chrome
CKEditor version: 3.6.2 :: 6.x-1.8 (Demo, Drupal module)
Drupal version 6.17 - PHP version 5.3.2-1ubuntu4.9
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.
All HTML correction options are unticked in Drupal and CKEditor configuration using Drupal's admin. So, is this a bug?
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 switching to WYSIWYG view:
<h2><a class="link-block" href="index.html">My Header</a></h2><p><a class="link-block" href="index.html">Some text.</a></p>
Browsers: Firefox, Safari, Chrome
CKEditor version: 3.6.2 :: 6.x-1.8 (Demo, Drupal module)
Drupal version 6.17 - PHP version 5.3.2-1ubuntu4.9
Re: Disable HTML correction
Documentation Manager, CKSource
See CKEditor 5 docs, CKEditor 4 docs, CKEditor 3 docs, CKFinder 3 docs, CKFinder 2 docs for help.
Visit the new CKEditor SDK for samples showcasing editor features to try out and download!
Re: Disable HTML correction
I have a similar problem. I try to use Smarty template syntax in the code editor. Now it changes the HTML.
from:
Re: Disable HTML correction
You can configure CKEditor to ignore your custom tags, see the config.protectedSource option. There are also plenty of posts on this issue on the forum and in the Internet, so just search for that.
See also the "Output" articles from CKEditor HOWTOs here: http://docs.cksource.com/CKEditor_3.x/Howto
As said before, however, CKEditor will *not* output invalid (X)HTML code (e.g. with block-level elements inside inline elements etc.).
Documentation Manager, CKSource
See CKEditor 5 docs, CKEditor 4 docs, CKEditor 3 docs, CKFinder 3 docs, CKFinder 2 docs for help.
Visit the new CKEditor SDK for samples showcasing editor features to try out and download!
The only solution I can find
The only solution I can find online or on the forums to this problem is to 'not use it'. Surely there has to be some way to make this great library not **** up one's code?
Do you know how web based
Do you know how web based WYSIWYG editors work? I'm affraid that not. If you'll learn about contenteditable you'll understand that we haven't got much control over what's happening.
Second thing which you need to understand is that CKEditor is not a WYSIWYG website builder. It is a document (contents) editor, so edited contents has to have a semantic correctness.
So the solution is quite simple - use CKEditor for purposes for which it was designed to be used.
Piotrek (Reinmar) Koszuliński
CKEditor JavaScript Developer
--
CKSource - http://cksource.com
--
Follow CKEditor on: Twitter | Facebook | Google+
config.protectedSource is not
config.protectedSource is not a good enough solution here for smarty loops. The only way around it we have found to work is HTML comments.
e.g.
Then on form submit
I'm still seeking the "perfect" solution.
Infact maybe just having protected source on the foreach loop is good enough? The code below protects all smarty tags;
I'll try and figure out how to make this {foreach} only
So this issue should only
So this issue should only really happen with foreach loops. The following code works for me:
My regex skills are weak so I don't know if this can be improved on.
Auto HTML formatted
Hi,
I would need some help here re: auto formating of html codes example scenario:
1. click the "source" button
2. enter this code: <a href=""><div>hellow</div></a>
3. click the "source" button, this is to see the output, always displays right output
4. click the "source" button again, the code change to: <p></p><div><a href="">hello</a></div>
5. source code should be not change from this code: <a href=""><div>hellow</div></a>
There the output was change to something. how to prevent the auto formating?
See http://dev.ckeditor.com
See http://dev.ckeditor.com/ticket/7961. This is a known issue and there's no easy workaround.
Piotrek (Reinmar) Koszuliński
CKEditor JavaScript Developer
--
CKSource - http://cksource.com
--
Follow CKEditor on: Twitter | Facebook | Google+