Reputation: 543
i try add custom class to body tinyMCE with custom button but not working. I don't know why.
This my tinyMCE custom button code:
(function() {
tinymce.PluginManager.add( 'columns', function( editor, url ) {
// Add Button to Visual Editor Toolbar
editor.addButton('columns', {
title: 'Insert Column',
cmd: 'columns',
image: url + '/columns.jpg',
});
editor.addCommand('columns', function() {
jQuery( 'body#tinymce' ).addClass( 'middle' );
jQuery(editor.iframeHTML).addClass( 'middle' );
});
});
})();
Please give me solutions to make code working. Thanks.
Upvotes: 0
Views: 640
Reputation: 247
Try to change this code
editor.addCommand('columns', function() {
jQuery( 'body#tinymce' ).addClass( 'middle' );
jQuery(editor.iframeHTML).addClass( 'middle' );
});
by this
editor.addCommand('columns', function() {
var b = editor.getBody();
b.className = b.className + " middle";
});
Upvotes: 1