How to customize TinyMCE / HTML Sanitizer

Hello, in html editor (TinyMCE) if I edit the source code and add a “class” attribute, e.g. in an “a” tag, when I save the record it looses the “class” attribute content. I use RemoveXSS extension.

This is your help file: Enable Raw at your own risk. If “Raw” is enabled, the field value is not sanitized, your site may be vulnerable to XSS attacks. If possible, try to change the configuration of HTML Purifier (HTML Sanitizer for ANM) instead of setting fields as “Raw”.

So I tried to setup the editor as following in Client scripts/Table specific/Edit page/Client script I put this code, but it doesnt’ work.

$(document).on("create.editor", function(e, args) {

    if (args && args.id == "x_Testo") {

        args.settings.extended_valid_elements = 'a[class|href|target|rel|title],img[class|src|alt|title|width|height],span[class],div[class]';

    }

});

If the problems depends on RemoveXSS extension, I have to enable Raw for the Testo field?

How can I customize HTML Sanitizer?

Read HtmlSanitizer allow attributes. Note that HtmlSanitizer is defined in ASP.NET Maker as:

public static HtmlSanitizer Sanitizer = new();

so you can do something like:

Sanitizer.AllowedAttributes.Add(“class”);

Alternatively just set the field to Raw.

In which code function do I need to modify HTML Sanitizer to setup a field in a specific table? I want to setup a specific field only, not all fields.

Try Table_Load