#10786 closed Bug (invalid)
CKEditor change Source Code formatting
Reported by: | Xuân Hùng | Owned by: | |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | General | Version: | |
Keywords: | Cc: |
Description
I try to edit an article, this is what i see :
This is a part of article content from database :
<h4>index.html</h4> <pre> <div id="clock" class="light"> </pre>
Problem is CKeditor formatted my source code to something like :
<h4>index.html</h4> <pre> <div id="clock" class="light"> </pre>
and this source code is disappeared. I tried :
config.protectedSource.push( /<pre[\s\S]*?\/pre>/g );
in config.js from https://drupal.org/node/803562 but it nothing change. Any ideas for this issue ?
Change History (2)
comment:1 follow-up: 2 Changed 11 years ago by
Resolution: | → invalid |
---|---|
Status: | new → closed |
comment:2 Changed 11 years ago by
I tested again. Because of the way i load Ckeditor, so it can not encoding HTML properly. Thank you very much.
I loaded following HTML to the editor and switched between wysiwyg and source modes few times (to simulate getting and setting data), but everything worked fine.
This is what I load and get after few modes switches:
I guess that you're not encoding your HTML properly when setting it in textarea. Note that this HTML:
Will give you (e.g. from textareaElement.value):
So you should load:
Which will give what you really want to load to the editor: