The whitelist plugin for CKEditor adds sanitization rules to the dataProcessor dataFilter and htmlFilter. If an element is not in the whitelist, it is removed, along with any child nodes:
// console.log("Remove " + element.name);
// The element (as well as any content or children) is removed.
return false;
However, I want to preserve any content/children. Basically, I’d like this:
This is <u>really</u> important!
To become this:
This is really important!
NOT this:
This is important!
Change line 37 of
whitelist/plugin.js. Instead of returningfalse, what removes entire element, write:delete element.name;This will remove element’s tags, but will leave the content.