[CKEditor] How to remove tags from the output of CK editor?

[CKEditor] How to remove tags from the output of CK editor?

  
Forge Component
(15)
Published on 2017-02-19 by Carlos Henriques
15 votes
Published on 2017-02-19 by Carlos Henriques

Hi Everyone,

I am creating a mail component ot send mail to the users. For that, I used CK editor component to input the content of the mail. When i am sending the mail , the contents are added with <p> tags. 

How to remove it? Please help!!!




The mail i am getting with <p> tags.


Solution

Hi Ananth,

This Stack Overflow article might be of help (note that was the very first Google hit of my search, Google is your friend!).

Solution

Kilian Hekhuis wrote:

Hi Ananth,

This Stack Overflow article might be of help (note that was the very first Google hit of my search, Google is your friend!).

Thanks Kilian,

I have added this in the config parameter, now I am not getting that irritating <p> tags.
config.autoParagraph = false


Cool it works Ananth! Happy coding :)

Hi, After putting autoParagraph = false. It's also removing Tollbar. Which I don't Want. Can anyone help on this?

Hi Arvind,

I'm pretty sure it isn't removing the toolbar because of that statement. Did you malformat anything? Can you share some code?

config code

SyntaxEditor Code Snippet

"toolbar:[
        ['Bold','Italic','Underline', 'Strike','Subscript','Superscript'],
        ['NumberedList','BulletedList','-','Outdent','Indent'],
        ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock', '-', 'Table'],
        ['Styles','Format','Font','FontSize'],
        ['autoParagraph' = False],
    ]"

Hi Arvind,

Why on earth are you adding the autoParagraph option to the toolbar????

Hi, In Config parameter Another developer already added code.  P tag appearing so now I am working to Fix it. Anyway to fix from here ? Not sure why Auto paragraph removing all other settings. Any option to Fix from here ?

Thanks in advance.

Arvind,

If I had to guess, autoParagraph removes all the other settings because it is an invalid option in a toolbar. It has nothing to do with the toolbar, at all! So CKE parses the toolbar options, finds an illegal option and gives up, not parsing or setting anything else.

The right way to set the option is, like the link I posted above says, add

CKEDITOR.config.autoParagraph = false;

to your code. Again, it has nothing to do with the toolbar. You can't just randomly put things somewhere.

Thanks for the information.

Hello,

I have a site property with the ckeditor config:


My site property is like this:


SyntaxEditor Code Snippet

"toolbar:[
['Cut', 'Copy', 'Paste', '-', 'Undo', 'Redo'], ['Link','Unlink'], ['Table', 'HorizontalRule', 'SpecialChar'], '/',
['FontSize'], ['Bold','Italic','Underline'], 
['NumberedList','BulletedList','Outdent','Indent','-','JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'], 
['TextColor','BGColor'], 
['Font', 'Styles', 'Format']
]

config.autoParagraph = false;"


but this do not work.

Whats the correct sintax to hide it?



In case you are still looking for help, the correct format would be: 

"toolbar:[
['Cut', 'Copy', 'Paste', '-', 'Undo', 'Redo'], ['Link','Unlink'], ['Table', 'HorizontalRule', 'SpecialChar'], '/',
['FontSize'], ['Bold','Italic','Underline'], 
['NumberedList','BulletedList','Outdent','Indent','-','JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'], 
['TextColor','BGColor'], 
['Font', 'Styles', 'Format']
],

autoParagraph: false,"


But I think autoParagraph is deprecated as I'm not finding it in the documentation. Instead, try 

enterMode: 2,