Try our conversational search powered by Generative AI!

Style and script tags are automatically removed from TinyMCE 2.7.0

Vote:
 

Hello,

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 ?

Thanks

Ravindra

#203017
Edited, Apr 06, 2019 7:45
Vote:
 

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

#203020
Apr 06, 2019 20:32
Vote:
 

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

#203033
Apr 08, 2019 9:29
Vote:
 

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.

https://www.tiny.cloud/docs-3x//reference/configuration/Configuration3x@valid_children/

https://stackoverflow.com/questions/3037501/tinymce-is-removing-style-tags

#203034
Apr 08, 2019 9:42
Vote:
 

Thanks Praful,

Yes, This resolved my issue.

I have used the below code in custom TinyMceInitialization class

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

Thanks again for the help.

#203036
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.