Try our conversational search powered by Generative AI!

Remove the table attribute border in TinyMCE v2

Vote:
 

When adding a table using the editor, border="1" automatically is added to the table. I am able to configure the border to be "0", but I would rather have the attribute removed since it is obsolete, and therefore also not WCAG 2.1 compilant. It that possible?

#229949
Edited, Oct 27, 2020 12:23
Vote:
 

In your TinyMCE configuration, just clear table_default_attributes, like this:

    [ModuleDependency(typeof(TinyMceInitialization))]
    public class TinyMceSettingsInitialization : IConfigurableModule
    {
        public void ConfigureContainer(ServiceConfigurationContext context)
        {
            context.Services.Configure<TinyMceConfiguration>(config =>
            {
                var tableSettings = new Dictionary<string, object>
                {
                    { "table_default_attributes", new {}}
                };

                config.Default().RawSettings(tableSettings);
            });
        }
    }
#229954
Edited, Oct 27, 2020 15:01
Vote:
 

Yes! Very nice, thank you :)

#230079
Oct 29, 2020 13:34
Vote:
 

Or, maybe better:

    [ModuleDependency(typeof(TinyMceInitialization))]
    public class TinyMceSettingsInitialization : IConfigurableModule
    {
        public void ConfigureContainer(ServiceConfigurationContext context)
        {
            context.Services.Configure<TinyMceConfiguration>(config =>
            {
                config.Default().AddSetting("table_default_attributes", new {});
            });
        }
    }
#230080
Oct 29, 2020 13:37
Vote:
 

Yes, I added it using this syntax to to remove all default attributes and inline styles :)

                    .AddSetting("table_default_attributes", new { })
                    .AddSetting("table_default_styles", new { });
#230082
Edited, Oct 29, 2020 13:39
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.