ps0604
ps0604

Reputation: 1071

Select a font in TinyMCE fontselect

I have defined a font select object in TinyMCE like so:

tinymce.init({
  selector: 'textarea',  
  toolbar: 'fontselect'
});

The problem is that when the editor is started, the font selected is "Times New Roman" and I need it to be "Arial". How can this be changed? Is it a keyword in tinymce.init ?

Upvotes: 2

Views: 5076

Answers (1)

Anand Dwivedi
Anand Dwivedi

Reputation: 1500

tinymce.init({
   selector: 'textarea',  
   toolbar: 'fontselect',
   setup : function(ed) {
    ed.onInit.add(function(ed) {
        ed.execCommand("fontName", false, "Arial");
        //Or ed.target.editorCommands.execCommand("fontName", false, "Arial");
        ed.execCommand("fontSize", false, "12");
    });
}
});

Try with above code and check . please go through: Changing the default font family in TinyMCE

Upvotes: 4

Related Questions