I've created a small plugin for tinymce4 that adds an additional dropdown menu with a list of headers (e.g. h1, h2...). The issue I'm facing is that I'm trying to display these header elements with their corresponding styles (e.g. <h1>Header H1</h1>
), but instead of HTML, I'm only getting plain text. What could be the mistake in my code?
tinymce.PluginManager.add('headings', function(editor, url) {
['h1', 'h2', 'h3', 'h4', 'h5', 'h6'].forEach(function(name){
editor.addMenuItem("headers_" + name, {
tooltip: "<"+name+">Заголовок</" + name+">",
text: "<"+name+">Заголовок</" + name+">",
onClick: function() { editor.execCommand('mceToggleFormat', false, name); },
onPostRender: function() {
var self = this, setup = function() {
editor.formatter.formatChanged(name, function(state) {
self.active(state);
});
};
editor.formatter ? setup() : editor.on('init', setup);
}
})
});
});
Can anyone point out where I might be going wrong?