Reputation: 670
I want to format the html output of CKEDITOR. I am using this code to set the rules for p
tags
editor_new = CKEDITOR.appendTo( 'editorSpace',{
on:{
instanceReady: function(ev){
this.dataProcessor.writer.lineBreakChars = '';
this.dataProcessor.writer.setRules( 'p', {
indent: false,
breakBeforeOpen: false,
breakAfterOpen: false,
breakBeforeClose: false,
breakAfterClose: false
});
It has changed the output format from
<p>Tony</p>
<p> </p>
<p>Stark</p>
to
<p>Tony</p>
<p> </p>
<p>Stark</p>
But the problem with this is when I use editor.getData()
on the editor, it adds one \n
after every line as it is a normal string. I want to eliminate that \n
on the backend side.
I want to configure the html of editor as this
<p>Tony</p><p> </p><p>Stark</p>
without any spaces and breaks so that the backend does not need to care about the data coming from frontend and stores it in database as-is. Is there any way I can achieve this?
PS: I have just shown example for p
tags. I want to achieve this for every tag. In short, I want to generate html in the same way a minified js file stores javascript content.
Upvotes: 2
Views: 4906
Reputation: 15895
Just get rid of HTML Output Writer plugin, i.e. with config.removePlugins
:
CKEDITOR.replace( 'editor', {
removePlugins: 'htmlwriter'
} );
Upvotes: 4