Sorry if this is already in the forum but I can't find any way to search this.
I see an old thread with a similar problem: http://ckeditor.com/forums/CKEditor-3.x/Escape-HTML-special-characters-only-New-feature with no conclusion.
What's happening is that my content in the database is something like "blha blah <a wifhweufhueuwf"
This content ends up inserted into the textarea in the page with the < still as an entity.
But when I replace this textarea withh ckeditor, it somehow turns the <: into an actual bracket < and the browser sees this as a tag opening and the rest of the text is invisible.
Does anyone know why this is happening or how I can turn this auto-conversion of entities off?
Please start with empty
Please start with empty editor (nothing in textarea) and insert this data as text not HTML.
var editor = CKEDITOR.replace( 'editor1', {
//resize_dir : 'both'
} );
editor.on( 'instanceReady', function( evt ) {
evt.editor.insertText('blha blah <a wifhweufhueuwf');//you can use variable here or server-side tag that will evaluate to string on page load.
});
Old Question - Same Issue
So I was running into the same issue. I have the situation where users occasionally paste in HTML/JS code intermixed with regular text (bug reporting system). The problem I have is that while it goes into and comes out of the database well (html character encoded - '<' instead of '<' ) it converts back to HTML or JS.
I tried j.swiderski's suggestion, and tossed my data from the DB into a variable and used that to populate the CKEditor after it had loaded. That just ended up placing all of the 'behind the scenes' html code into the display. So the rugular user text is now wrapped in <p></p> tags, and no formating is maintained.
Any thoughts or ideas?
Hi,
Hi,
I wasn't clear enough here. CKEditor is HTML editor and some wrapping HTML will always be there. If you use text only then html depends on enter mode used: http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-enterMode.
To keep the story short. You should create and edit your messages in same environment - CKEditor.
You should always use HTML for that.
Characters like < > can be inserted with Special Character Plugin.
If you want to insert code from DB then please insert HTML, not text (because plain text is gonna get wrapped anyway) e.g.