When a user submits code that contains <> they are converted to < and > in the source. They are displayed as < > in the editor. This is how it should be. The user presses submit, it saves to the database with the html encoded values (< >) and displays with the encoded values fine. When the user goes to edit his post, CKEditor takes those < > values and converts them back to < > and they disappear from the editor completely.
A user typed this in a post:
Which is encoded (and saved in the database) as:
When the user goes to edit, CKEditor takes those values and converts them back to < and >. Because they are a <location> tag with no meaning, they disappear. I've verified that the text in the text area is still html_encoded all the way up until the value is given to the textarea.
I've messed around the the config.entities option which seems to have no effect either way. What can I do to prevent CKEditor from decoding these entities when supplying a value to the text-area for editing?
A user typed this in a post:
<location> AddOutputFilterByType DEFLATE text/html text/plain text/xml text/x-js text/css </location>
Which is encoded (and saved in the database) as:
<location> .... </location>
When the user goes to edit, CKEditor takes those values and converts them back to < and >. Because they are a <location> tag with no meaning, they disappear. I've verified that the text in the text area is still html_encoded all the way up until the value is given to the textarea.
I've messed around the the config.entities option which seems to have no effect either way. What can I do to prevent CKEditor from decoding these entities when supplying a value to the text-area for editing?
Re: HTML Entities Problem - &lt; &gt;
Have someone solved this problem? Cofig.entities does not have any effect.
edit: it has effect only for html known entities.. if entities=true <h1>save like <h1> and if entities=false <h1>save like <h1>thats OK. If you have something like smarty code {$link->name} it is saved with > no matter on entities setting. It is another setting for this??
Re: HTML Entities Problem - &lt; &gt;
Like I said, I don't like it but config.entities does nothing. I would expect when that is set to false that no output is converted.
Same problem here - 5 years later - still no decent solution
I have the same problem - here's what comes from the database:
and when loaded to ckeditor - is converted to:
Could someone on the editor team have a look at this problem please?
ACF seems to be changing your
ACF seems to be changing your code. You can customize it by following this guide. Add config.allowedContent = true; to the config.js file to see if that helps, though it's not recommended leaving it like that.
Customer and Community Manager, CKSource
Follow us on: Facebook, Twitter, LinkedIn
If you think you found a bug in CKEditor, read this!
It was additional htmlentities() function that was needed
Apparently I had to re-encode the entities to convert < to &lt; on editor load - this solved the problem. Thanks for the suggestion @sebstefanov - appreciate it.