Virtual Happy Hour this month, Jun 28, we'll be getting a sneak preview at our soon to launch SaaS CMS!

Try our conversational search powered by Generative AI!

TinyMCE Custom classes on link


I am trieing to add custom classes on a link. 
What i have so far is:

    public class CustomizedTinyMceInitialization : IConfigurableModule
        public void ConfigureContainer(ServiceConfigurationContext context)

            context.Services.Configure<TinyMceConfiguration>(config =>
                    .Toolbar("styleselect | formatselect | bold italic underline | epi-link anchor | image epi-image-editor epi-personalized-content | bullist numlist outdent indent | epi-dnd-processor | removeformat | fullscreen")
                        new { title = "Deep Blue", inline = "a", classes = "btn btn-deep-blue" },
                        new { title = "Fresh Blue", inline = "a", classes = "btn btn-secondary" },
                        new { title = "Warm Coral", inline = "a", classes = "btn btn-primary" })
                    .BlockFormats("Paragraph=p;Heading 2=h2;Heading 3=h3;Heading 4=h4;Heading 5=h5;Heading 6=h6;");

        public void Initialize(InitializationEngine context) { }

        public void Uninitialize(InitializationEngine context) { }

Now i can place the links with the custom classes but i can not set/edit the url of the link.

I am using TinyMCE version 4.9.11 and Optimizely version 11.20.4

Edited, Dec 03, 2021 13:18

Hi Henk,

I think this is just because you're missing AddPlugin for epi-link, it should look something like:


If you switch your style formats to selector (opposed to inline)  then they'd only be applicable to links, like so:

new { title = "Deep Blue", selector = "a", classes = "btn btn-deep-blue" }

Depends what functionality you're going for.

Dec 07, 2021 8:47
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.