Reputation: 11
I need your help about custom formats on tinymce.
I replaced the default formats with custom classes :
tinymce.init({
formats: {
h1: {inline : 'span', 'classes' : 'head1'},
h2: {inline : 'span', 'classes' : 'head2'},
h3: {inline : 'span', 'classes' : 'head3'},
h4: {inline : 'span', 'classes' : 'head4'},
h5: {inline : 'span', 'classes' : 'head5'},
h6: {inline : 'span', 'classes' : 'head6'},
},
But if I select a word and I click on "Format 1" then "Format 3", result is :
<span class="head1 head3">my words</span>
I would like format3 to replace format1 like that :
<span class="head3">my words</span>
I did not find anything in the documentation that allowed me to do it.
Thanks for your help :)
Upvotes: 1
Views: 199
Reputation:
What you're asking to do is counter-intuitive to the rest of the formatting buttons in place. If you press the bold
button, and then the italic
button, the bold formatting is not overwritten, it's only added to.
The same goes for any custom formatting. You'll need to deselect head1
for it to disappear from the class list of your span.
Upvotes: 1