25
Views
1
Comments
[CKEditor 5] Unable to show HTML with custom CSS in CK Editor
ckeditor-5
Reactive icon
Forge asset by Vincent Koning
Application Type
Reactive
Service Studio Version
11.55.57 (Build 64615)

Hi @Folks

I am using CK Editor for Template Generation steps as below

1. I am Fetching template document and converting Binary file into HTML to get the RAW code.

2. Now i am replacing my Keywords with dynamic values from database

3. Now i want to show this modified HTML and CSS into CK Editor.

Issue i am facing here input HTML for CK editor is correct but the  CK editor is removing all the CSS and classes written into it and i am getting Plain HTML text with all the CSS and classes removed so my template is distorted.

Can someone help me out with this , My CK editor should show the data with proper formatting.

2026-03-20 01-28-51
Saugat Biswas

Hi @Jitendra Kumar ,

You’re running into expected CKEditor behaviour, not an OutSystems bug. CKEditor is sanitising your HTML via its Advanced Content Filter (ACF) and intentionally stripping CSS, classes, and  blocks unless you explicitly allow them.

Correct approach for OutSystems templates (recommended)

OPTION 1: Move CSS out of the HTML completely 

Do NOT inject into CKEditor content. 

Instead: 

  • Put all CSS in: 
    • Theme CSS 
    • Screen CSS 
    • Block CSS 
  • Use class-based styling only in your HTML

Example HTML stored in CKEditor:

<div class="invoice-header"> 
     <h1>{{CustomerName}}</h1>
</div> 

And CSS (Theme / Screen):

,invoice-header {
     font-weight: bold;  
     margin-bottom: 16px;
}

This is the only fully supported approach in CKEditor 5.

OPTION 2: Allow CSS classes in CKEditor configuration

By default, CKEditor strips classes unless allowed. In OutSystems CKEditor Forge, enable Extra Allowed Content:

extraAllowedContent: '*(*)'`` 
OR
extraAllowedContent: 'div(*);span(*);p(*);table(*);tr(*);td(*)'`` 

This tells CKEditor: 

  • Allow any class 
  • Preserve formatting 
  • Still keep filtering active

This behaviour is documented in CKEditor ACF rules.

Hope this helps.

Cheers.

Saugat

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.