I am using jquery tinymce editor. Default font size is 10. I like to change that default font size. How can i do that,
Add a custom font family to the menu TinyMCE comes with 17 font options by default. Depending on the editor configuration, users can select a font from the menubar or the toolbar (via the fontselect dropdown). A user selects a font from the fontselect toolbar menu.
Under the hood: You can see string like "height": 120, in data-mce-conf attribute of the generated HTML for the textarea.
This plugin adds the forecolor/backcolor button controls that enable you to pick colors from a color picker and apply these to text. It adds a toolbar button to enable this functionality.
You need to use the content_css setting of tinymce to set a custom css file of your own (make sure this setting points to a valid location of a css file). This file will be inserted in the editor iframes head after all other css settings(files from the core) are inserted there when initialising tinymce - thus all settings you place in your file will overwrite the settings made before (by tinymce).
Example: Setting the default font-size to 11px. Content of a custom css file (i named it content.css in my installation):
body {
font-family: Verdana,Arial,Helvetica,sans-serif;
font-size: 11px;
}
How to use this setting:
tinyMCE.init({
...
// you do not need to include it yourself, tinymce will do this for you,
// but you will need to give tinymce the location of your css file
content_css : "http://www.myserver.com/css/content.css",
...
});
I have used in my project in this way
tinymce.init({
selector:"#txt1",
setup : function(ed)
{
ed.on('init', function()
{
this.execCommand("fontName", false, "tahoma");
this.execCommand("fontSize", false, "12px");
});
}
});
This is the better way than just changing property values in 'content.css'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With