Reputation: 314
I Want to set the default fontfamily and font size to 'Calibri' and '11px'. I try to using this code
//set the editor font size
ed.on('init', function()
{
this.getBody().style.fontSize = '11pt';
this.getBody().style.fontFamily = 'Calibri';
});
It is working well, The text font is 'Calibri' and font size is '11px' . But the font family and font size on the tool bar 'font family' and 'font sizes'. I try with jquery in focus event . But it is not working.
$('#mceu_0-open span').text(tinymce.editors[0].getBody().style.fontFamily);
$('#mceu_1-open span').text(tinymce.editors[0].getBody().style.fontSize);
I want to set the text of the font family is 'Calibri' and size is '11px'.
Upvotes: 0
Views: 1238
Reputation: 21
All you need to do is to add fontsizeselect to your toolbar config param:
toolbar: "sizeselect | bold italic | fontselect | fontsizeselect",
Update
tinymce.init({ fontsize_formats: "8pt 10pt 12pt 14pt 18pt 24pt 36pt" });
Upvotes: 2
Reputation: 30557
Try something like this:
$('.tinymce').tinymce({
setup : function(ed) {
ed.onInit.add(function(ed) {
ed.execCommand("fontName", false, "Calibri");
ed.execCommand("fontSize", false, "11");
});
}
});
Changing the default font family in TinyMCE
Upvotes: 0