General help

 
 
Picture of Barb Hall
Changing font in html edit area
 

Hello,

I've just updated to 2.5, and everything is working great!  I'm wondering if there is a way to have a default font appear when typing in an html area anywhere it appears in moodle. 

Right now the default seems to be Arial size 3, and I'd like it to be Trebuchet size 4.  I've changed the body tags, etc., so the rest of the site appears the way I want i to, but am wondering what style element I'd need to change and where to change it so that I don't have to modify the font style and size every time I edit or add something.  It would save me so much time!

I did find a similar issue to that from ages ago but it referred to a much older version of moodle.

Thanks in advance,

Barb

 
Average of ratings: -
Picture of Alan Bradshaw
Re: Changing font in html edit area
 

The text editor (TinyMCE) places its editable area in a completely separate document in an iframe (where the <body> has a class of mceContentBody) so its styles are not inherited directly from your moodle site. You have to create some special style rules and in particular target  body.mceContentBody

I have not attempted this in moodle so I don't know exactly which stylesheet this can go in, and I expect it also depends on which version of moodle.

There's more about how this works at the TinyMCE website

 

 

 
Average of ratings: -
Tim at Lone Pine Koala Sanctuary
Re: Changing font in html edit area
Group DevelopersGroup Documentation writersGroup Particularly helpful Moodlers

It is meant to be a WYSIWYG editor. ideall the text in the editor to look exactly the same as it will look when posted. That it not always the case, in which case you should not worry about how things look in the editor. It may look OK when posted even if it looks wrong in the editor.

The way this is controlled in Moodle is a file called theme/.../styles/editor.css in the theme. Knowing that is only helpful if you know how to create a theme (or want to learn).

 
Average of ratings: -
Picture of Barb Hall
Re: Changing font in html edit area
 

Hi Tim, and thanks, I'll look into that.

I guess what I'm after is similar to what this moodle site has set up, in the default font is the same as what is displayed.

If there is only one font listed in the drop down list for font family will that have the same effect?

Thanks in advance,

Barb

 
Average of ratings: -
Picture of AL Rachels
Re: Changing font in html edit area
Group DevelopersGroup Particularly helpful MoodlersGroup Testers

Hi Barb,

If you could tell us what theme you use, we could be more specific...but here goes...

When you go to Administration > Plugins > Text editors > TinyMCE HTML editor > General settings> Available fonts list, you can add to the available fonts or change the order of fonts listed in the editors drop down list. BUT, what actually gets set as your default is set by your theme.

On the same settings page, there is a custom configuration box. I have found a number of settings I can place in there that will receive a check mark showing it should be ok, but invariably, my theme over rides them.

I typically use the anomaly theme on my development site and to do what you want is very easy set up, as it has a css file specifically for the editor.  In the file located at yourmoodle/theme/anomaly/style/editor.css on line 2 is the default font size, and on line 6 is the default font family. Whatever I set there, is what I get any time I open an editor window. Of course, while editing, if you change the font or size, it does start typing with the new settings. HOWEVER, once it is saved, again there are other settings in the theme that can change the look and wipe out those editor settings. The only way I have been able to get text to be different when displayed, is by using the settings in the editor... it gives me wysiwyg.

Whether or not an editor.css file is in a theme is just up to the theme designer. A quick look through shows that some do and some don't have an editor.css file. If yours does not, you would just have to look through your theme and search for the settings you need modify for what you want.

Basically, to get what you want, you will have to go through your theme files

Hope this helps,

AL

 
Average of ratings: -