Reputation: 50840
I am using the formats paramter to initialize tinymce in order to use b-,i- and u-tags instead of spans and styles
formats: {
bold : {inline : 'b' },
italic : {inline : 'i' },
underline: { inline: 'u' }
},
When i save the content, the u-tags get replaced by spans (i- and b-tags are not affected):
<span style="text-decoration: underline;">underlined text</span>
What can i do to keep my u-tags in the html?
Upvotes: 3
Views: 1613
Reputation: 50840
After some "try and error" i found a solution which works. But i am sure there is a more elegant way. Feel free to point me into the right direction. My solution consists of the replacement of the new span back to the u-tag on the onSave event:
ed.onSaveContent.add(function(ed, o) {
o.content = o.content.replace(/<span style="text-decoration: ?underline;">(.*?)<\/span>/gi, "<u>$1</u>");
});
Felix Risterer mentioned the legacyoutput plugin. It works with this plugin too, but i will stick with the solution above cause the legacyplugin does many things and i am not fully able to predict what else could be affected.
Upvotes: 2