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.
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:
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: '*(*)'`` ORextraAllowedContent: 'div(*);span(*);p(*);table(*);tr(*);td(*)'``
This tells CKEditor:
This behaviour is documented in CKEditor ACF rules.Hope this helps.
Cheers.
Saugat