How to add custom formats to TinyMCE Rich Text Editor

I’m trying to add a few simple custom formats to TinyMCE RTE.

Here’s what I have:


[{"title": "Custom Format", "items": "custom_format"},{"title": "Headers", "items": "headers_format"},{"title": "Inline", "items": "inline_format"},{"title": "Blocks", "items": "blocks_format"},{"title": "Alignment", "items": "alignment_format"}]


[{"title": "Text Purple", "selector": "span", "classes": "tp-colour-purple"}]

This works to a point, but ultimately, the option is greyed out in the editor:


Has anyone got this sort of setup working?

Where am I going wrong?

Not sure if “selector” is the correct parameter.

Maybe try this instead:

[{"title": "Text Purple", "inline": "span", "classes": "tp-colour-purple"}]

Aw @halftrainedharry !

Thanks so much :+1:

I’d tried various approaches including something similar … but that’s the format!

This topic was automatically closed 2 days after discussion ended and a solution was marked. New replies are no longer allowed. You can open a new topic by clicking the link icon below the original post or solution and selecting “+ New Topic”.