How can I disable CKEditor to get me every time
, when i don\'t want them? I\'m using CKEditor with jQuery adapter.
I don\'t want to have any
I had the same problems creating some tables. What I saw was that if i created the tables with the css rule align="left"
the <p> </p>
are added, but if i changed the css rule to align="center"
i could edit the paragraphs out and they were not added again.
I noticed some text editing operations, like deleting a character (by hitting Backspace button) are spliting edited text node into two. Hitting Space Bar at the end of such newly created text node is always resulting into
instead of normal space. I am calling normalize()
http://www.w3schools.com/jsref/met_node_normalize.asp to changed element after change:
CKEDITOR.on('instanceReady', function (ck) {
ck.editor.on("change", function (e) {
var sel = ck.editor.getSelection();
if (sel) {
var selected = sel.getStartElement();
if (selected && selected.$)
sel.getStartElement().$.normalize();
}
});
});
I had already had to play around with config.js, so in order to fix '?' showing up in safari I ended up with 3 lines in config.js
config.fillEmptyBlocks = function (element) {
return true; // DON'T DO ANYTHING!!!!!};
config.entities = false;
config.basicEntities = false;
There is another way that a non breaking space character can occur. By simply entering a space at the end of a sentence.
CKEditor escapes basic HTML entities along with latin and greek entities.
Add these config options to prevent this (you can also add them in your config file):
CKEDITOR.on( 'instanceCreated', function( event ) {
editor.on( 'configLoaded', function() {
editor.config.basicEntities = false;
editor.config.entities_greek = false;
editor.config.entities_latin = false;
editor.config.entities_additional = '';
});
});
These options will prevent CKEditor from escaping nbsp gt lt amp ' "
an other latin and greek characters.
Sources: http://docs.ckeditor.com/#!/api/CKEDITOR.config http://docs.ckeditor.com/source/plugin48.html#CKEDITOR-config-cfg-basicEntities
If you're using PHP you can use the following :
preg_replace("/[\<]p[\>][\s]+ [\<][\/]p[\>]/" , " " , $pre_comment);
This will remove : "<p> </p>"
Enjoy :)
Maxwell
Try:
config.basicEntities = false;
for me fixed the problem.