[CKEditor] CKEditor - How to remove only specific html tags

Forge Component
(28)
Published on 26 May (9 days ago) by Prasad Rao
28 votes
Published on 26 May (9 days ago) by Prasad Rao

Hello,

I am using CKEditor where i have some content. I have used HTML Utils to convert the html tags to text but with this all the formatting(like bold,Italic) texts are also removed .  Is there a way somehow i can keep these text styling while converting.

Thank you.

Hi Puja Rani,

If you remove the HTML tags from you content you will lose all formatting...

Why are you removing the html tags to start with?

Hi Puja,

If you will remove all the HTML tags then it will automatically remove all the styling also as these styles are applied through HTML tags only, either through css class or style attribute.

So If you want styling without the HTML tags then I think there is no way to do that.


Jorge Martins wrote:

Hi Puja Rani,

If you remove the HTML tags from you content you will lose all formatting...

Why are you removing the html tags to start with?


Hi Jorge,

I have a screen where i am maintaining some email templates, the content is in the CKEditor. Now i am using the same email template for sending emails. So when i am receiving an email it would come with html tags therefore i used the converter, but then i realized its removing all the formatting as well, so wanted to know if there is a way out with which i can still have the styling,

Solution

Puja Rani,

You can use an Expression on your Email canvas to display your content with HTML properly rendered by setting its Escape Content to No. This will just put the HTML directly on your screen, allowing the browser/email client to interpret it instead of displaying it.

Use this property consciously as it disables safety mechanism that the platform does for you automatically where it safeguards your dynamic content from HTML/JavaScript code-injection.

Hope this helps!

Solution

Jorge Martins wrote:

Puja Rani,

You can use an Expression on your Email canvas to display your content with HTML properly rendered by setting its Escape Content to No. This will just put the HTML directly on your screen, allowing the browser/email client to interpret it instead of displaying it.

Use this property consciously as it disables safety mechanism that the platform does for you automatically where it safeguards your dynamic content from HTML/JavaScript code-injection.

Hope this helps!


Thank you .