rb vishnu rb vishnu - 10 months ago 94
Javascript Question

How to remove unicode character in tinymce formatter.toggle()

What I am trying to do is to creating a markup element in my editor as like formatting tags ie, bold, italic.

For that I have defined custom formats while tinymce.init as

formats: {
email: {inline: 'span', classes:'email', remove: 'all'}

and in my custom plugin have called
for toggling selected text with
<span class="email" />
. Its working fine, but the problem is while toggling
<span class="email">abc@def.com</span>
what I am getting is the text is enclosed within the unicode character as
this cause issue on further toggling.
How to avoid the unicode character as like toggling working for formatting elements in tinymce?

Answer Source

Found solution to my problem.

To prevent the enclosing of unicode character, added parameter selector: "span" to custom format

formats: {
    email: {inline: 'span', selector: 'span' classes:'email', remove: 'all', }