adding CSS style tags to moodle/atto/tinyMCE text editor

adding CSS style tags to moodle/atto/tinyMCE text editor

by Brett Myburgh -
Number of replies: 2

Hi there, 

I'm new to Moodle (version 2.8.1). I realise this question may not be exactly developer related or if that I am even posting in the right section here.

My problem that I am having; when adding HTML (in the 'Edit HTML source' part of the text editor) with CSS in the <style> it does not retain the styling, only keeping the HTML. I have tried with both atto and tinyMCE text editor with basically the same result.

Is there a way that I can paste in the HTML and keep the CSS style tags into any of the text editors? 

For a bit of background, I need this as part of an automatic 'custom certificate plugin' that has just been developed. 

Thanks,

Brett

Average of ratings: -
In reply to Brett Myburgh

Re: adding CSS style tags to moodle/atto/tinyMCE text editor

by Colin Fraser -
Picture of Documentation writers Picture of Testers

AFAIK, neither Atto or TinyMCE will allow additional CSS in via the editing interface. When you think about it, would you really want Users adding additional CSS into their replies? Isn't there a Certificate plugin already available? I am sure there is a way around this, but not like you want. Likely the CSS is going to have to be part of the plugin, added in when a certificate is included.... but I am not a dev...

In reply to Brett Myburgh

Re: adding CSS style tags to moodle/atto/tinyMCE text editor

by William Lu -
Picture of Particularly helpful Moodlers
Is there a way that I can paste in the HTML and keep the CSS style tags into any of the text editors? 

Yes. First, you edit your own profile and change the Text Editor from HTML to Plain text, then you can add any code into the Text area and the code will stay there. Just to be aware that: If other teacher edits this page accidentally without switch his/her profile to Plain text mode, your code will GONE! 

A little bit safer way to protect you CSS code is to  add the CSS into a block, and Change teacher's permission of  Edit a block's setting = Prevent 

The safer way is to Add your CSS into the Theme settings. If you can not do that in site level, you can ask your admin to install Justin's Generico plugin for you. Then, you just need add a small piece of Generico code.

I added some CSS for Text Styles into TinyMCE. Our users just need highlight a text and selects my customised style from a drop down menu. Because I am not sure if I can add customised style into ATTO or not, I am currently not using ATTO in my Moodle sites  yet, even I really love the Auto Save feature of ATTO.

Average of ratings: Useful (3)