Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#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:


I try to edit an article, this is what i see :

This is a part of article content from database :

     &lt;div id=&quot;clock&quot; class=&quot;light&quot;&gt; 

Problem is CKeditor formatted my source code to something like :

     <div id="clock" class="light"> 

and this source code is disappeared. I tried :

config.protectedSource.push( /<pre[\s\S]*?\/pre>/g );

in config.js from but it nothing change. Any ideas for this issue ?

Change History (2)

comment:1 Changed 10 years ago by Piotrek Koszuliński

Resolution: invalid
Status: newclosed

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:

     &lt;div id=&quot;clock&quot; class=&quot;light&quot;&gt; 

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:


comment:2 in reply to:  1 Changed 10 years ago by Xuân Hùng

I tested again. Because of the way i load Ckeditor, so it can not encoding HTML properly. Thank you very much.

Note: See TracTickets for help on using tickets.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy