Setting the default font size and background color in TinyMCE

How to set default font size and background color in TinyMCE?

Thanks Eden

+6
tinymce
source share
3 answers

You can also change css using Javascript.

Add this to your init function:

oninit : "postInitWork", 

and

 function postInitWork() { tinyMCE.getInstanceById('textedit').getWin().document.body.style.backgroundColor='#FFFF66'; var dom = tinymce.activeEditor.dom; var pElements = dom.select('p'); // Default scope is the editor document. dom.setStyle(pElements, 'color', 'red'); } 
+3
source share

Have you tried the content_css option? This is mentioned in the TinyMCE FAQ: http://wiki.moxiecode.com/index.php/TinyMCE:FAQ#Change_default_text_color.2Feditor_background_in_TinyMCE.3F

You can specify a CSS file for your editor with this, allowing you to set things like font color and background.

Hope this helps; thanks Sam

(I understand this is a very old article, just adding it in the interests of anyone else reading since)

+3
source share

background

So, you would copy the / advanced / editor _ui.css themes to your own location, edit the colors and should be fine.

 .mceEditorArea { font-family: "MS Sans Serif"; background: #FFFFFF; } 

font size

 tinyMCE.init({ ... font_size_style_values : "xx-small,x-small,small,medium,large,x-large,xx-large" }); 

Anyway, google is your friend

0
source share

All Articles