Try our conversational search powered by Generative AI!

Internal style tags getting stripped in TinyMCE editor

Vote:
 

Hi,

The TinyMCE editor is removing the internal CSS from the 'code' view. Is there any configuration to tell TintMCE to not strip the internal style tags within the code view?

TinyMCE version: 4.9.11

#255457
May 25, 2021 4:46
Vote:
 

What do you mean be INTERNAL style tags?

Could you give an example of the markup you are trying to add, and what it looks like after TinyMCE have stripped away some of it?

#255492
May 25, 2021 11:50
Vote:
 

Hi Syed,

Create an initialization module and use this code-

using EPiServer.Cms.TinyMce.Core;
using EPiServer.Framework;
using EPiServer.Framework.Initialization;
using EPiServer.ServiceLocation;

namespace ABC.Framework.Web.Business.Initialization
{
    [InitializableModule]
    [ModuleDependency(typeof(TinyMceInitialization))]
    public class TinymceCustomInitialization : IConfigurableModule
    {
        public void ConfigureContainer(ServiceConfigurationContext context)
        {
            // browser console to see settings: window.tinymce.settings;

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

        public void Initialize(InitializationEngine context) { }

        public void Uninitialize(InitializationEngine context) { }
    }
   
}
#255568
May 26, 2021 8:06
Syed Quadri - May 27, 2021 6:31
Thanks.It worked.
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.