Change Bold option from <strong> tag to <b> tag doesn't work in TinyMCE 4.3.11. Test: Chrome 50 and Firefox 46 and IE 11.
Configuration:
formats: {
bold : {inline : 'b' },
italic : {inline : 'i' }
},
Here is my investigation:
Configuration is readed correctly. Button 'Bold' and shortcut Ctrl+B works also - they are adding tag <b> to the editor.
But during textarea content retrieving TinyMCE has some processing feature which change all <b> to <stron> (and <i> to <em>). So returned HTML has unwanted <strong> and <em> tags.
For example you could call function getContent():
tinyMCE.activeEditor.getContent()
It calls Editor.getContent and then editor.serialize where the code starts parsing process:
// Parse HTML
rootNode = htmlParser.parse(trim(args.getInner ? node.innerHTML : dom.getOuterHTML(node)), args);
Next the code call SaxParser.self.parse which has such code:
if (isValidElement) {
self.start(value, attrList, isShortEnded);
}
And finally the start function calls such function:
schema.getElementRule(name) //where name is "b", but result is "strong"
The result is Object with "outputName" property set to "strong".
Why??? (in configuration I kindly ask to use <b> in case of bold test) - why TinyMCE is not obedient??
And then new HTML node is added - the <strong> node of course.
In my opinion this is the problem - the getElementRule function shouldn't return "strong" when configuration has "formats" option.
Please look also at code in _Schema.js_:
if (settings.schema != "html5") {
each(split('strong/b em/i'), function(item) {
item = split(item, '/');
elements[item[1]].outputName = item[0];
});
}
Setting schema to "html5" solve this problem, but I still think that "formats" configuration should work without this "hack".
We force every thing into strong and em by default since they have semantic meaning for a screen reader. You can re-configure it to produce b and i by simply setting extended_valid_elements: 'b[_],i[_]'
Closing this one since it's a config issue.
@spocke, b and i have more appropriate semantic meaning, applying a styling difference. strong and em alterate about sense (importance and emphasis).
FYI, Outlook 2010 doesn't read em elements as italicised text.