Need Help Cleaning Pasted Content While Retaining Table Structure – Syncfusion RTE (Angular)

Hi Team,

I’m using the Syncfusion Rich Text Editor in an Angular application. I want to clean pasted content such that it removes all styles, classes, and formatting — and leaves only clean HTML (e.g., <p>, <table>, <tr>, etc.).

To achieve this, I used pasteCleanupSettings with the "style" tag in the deniedTags array. However, when I do that, the pasted table structure breaks or loses its layout, and only the raw content remains (not visually structured as a table).

I also tried beforePasteCleanup, but I still need help figuring out the correct approach to clean unnecessary styles while preserving essential table layout and tags. Attached screenshot as well, when style attribute is denied, this is how table looks in editor.


Attachment: Screenshot_(105)_ff9809bd.png

1 Reply

BT Bhuvaneshwari Thirunavukarasu Syncfusion Team June 9, 2025 12:03 PM UTC

Hi Lisha Bansal,

Thank you for reaching out.

To clean pasted content while preserving structure like <p>, <table>, and <tr>, configure pasteCleanupSettings as follows:

public pasteCleanupSettings: PasteCleanupSettingsModel = {

        prompt: false,

        plainText: false,

        keepFormat: false,

        

    };


This removes unwanted styles and formatting without breaking the layout.


Please note that if the pasted content heavily relies on class names for its layout, removing those may affect the visual formatting of the table or other elements. In such cases, some visual degradation is expected since structural formatting is often style dependent.


For your reference, we’ve attached a working sample and a screenshot.


Best regards,
Bhuvaneshwari T

Loader.
Up arrow icon