rb vishnu rb vishnu - 1 month ago 10
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
editor.formatter.toggle(markup);
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
"&#65279;abc@def.com&#65279;"
this cause issue on further toggling.
How to avoid the unicode character as like toggling working for formatting elements in tinymce?

Answer

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', }
}

http://archive.tinymce.com/wiki.php/Configuration3x:formats

Comments