Try our conversational search powered by Generative AI!

Style and script tags are automatically removed from TinyMCE 2.7.0



We have upgraded our solution from Epi 9 to Epi 11. Now we are facing an issue when we apply any "<style>" or "<script>" tag in the TinyMCE and save. it is automatically removed from the TinyMCE editor.

Anyone have any idea ?



Edited, Apr 06, 2019 7:45

You should try upgraded version of TinyMCE Editor or I mean upgrade it. It should resolve your issue.

Apr 06, 2019 20:32

I tried other versions for this module but it still not supporting these tags.

Apr 08, 2019 9:29

Hi Ravindra,

You need to add style tag as a valid child, as the TinyMCE doesn't count the style tag as a valid child.

valid_children : "+body[style]"

Follow this link for more information.

Apr 08, 2019 9:42

Thanks Praful,

Yes, This resolved my issue.

I have used the below code in custom TinyMceInitialization class

   context.Services.Configure<TinyMceConfiguration>(config =>
                    .AddSetting("valid_children", "+body[style]").AddSetting("extended_valid_elements", "script[language|type|src]");

Thanks again for the help.

Apr 08, 2019 10:31
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.