Using css in TinyMCE

I am using ForeColor in TinyMCE Rich Text Editor.

it uses a style to apply forecolor to the selected text as it looks

<span style="color: rgb(255, 0, 0);" mce_style="color: #ff0000;">Hello</span>.

I want to apply the css class instead of "style" here. How to apply css class here? These Css classes contain ColorCodes.

Example:

<span class="colorRed">Hello</span>

My CSS Class

.colorRed
{
color: #ff0000;
}

Thank you

+5
source share
2 answers

Since you want your css to be applied to the tinymces text editor, you need to add your class to the class with which your content is styled.

content_css tinymce (init-function), content_css , init ( ).

content.css, , content_css init. . tinymce . content.css .

+8

content_css CSS (, myLibFolder/myCss.css) ","

$('textarea.tinymce').tinymce({
                    // 
                    //
                    //....
                    ,
                    content_css: "css/content.css,myLibFolder/myCss.css"  
                    ,
                     //


});
+1

All Articles