TINYMCE custom format classes - how to add one span with a class outside the highlighted paragraphs

167 views Asked by At

I am trying to add a css class to a highlighted text using TINYMCE editor but if a text with a few paragraphs is highlihted a separate span with a class is added to each paragraph.

Here is the code:

`customformat: { inline: 'span', styles: { color: '#00ff00', fontSize: '20px' }, attributes: { title: 'My custom format'} , classes: 'customclass'}`

and if I want to apply the customformat to:

`<p style="text-align: justify;">parapgraph1</p>
<p style="text-align: justify;">parapgraph2</p>`

*I get this: *

`<p style="text-align: justify;"><span class="episodeclass" style="color: #00ff00; font-size: 20px;" title="My custom format">parapgraph1</span></p>
<p style="text-align: justify;"><span class="episodeclass" style="color: #00ff00; font-size: 20px;" title="My custom format">parapgraph2</span></p>`

*How can I get this: *

`<span class="episodeclass" style="color: #00ff00; font-size: 20px;" title="My custom format">
<p style="text-align: justify;">parapgraph1</p>
<p style="text-align: justify;">parapgraph2</p>
</span>`
0

There are 0 answers