tags:

views:

70

answers:

1

Hello..

I am implementing ForeColor in TinyMCE Rich Text Editor.

it uses style to apply forecolor to selected text as like this

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

i want to apply 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

+2  A: 

Because you want your css to be applied to tinymces editor content you will need to add your class to the class your editor content gets styled with.

If you are not using a user-defined content_css file when initializing tinymce (init-function) a content_css file will be used depending on the theme you have set in the init function (file used is to be found in a subfolder of folder themes).

I suggest you create an own content.css which you load using content_css setting in the init function. See this link for the tinymce documentation for this. For a first step you could copy one of the content.css from the themes directory and modify it.

Thariama
thank you for replying..i just copied the contents from content.css to a new css file and included my color codes.. then i included content_css : "/mycontent.css" to tincyMCE init function in tiny_mce_src.js file.Do i followed the instructions correctly?i am not getting the expected output!!
SAK
you may use firebug to have a look into the tinymce editory iframes head to verify if it took your css file. if you are not sure tiny took your css file try an URL containing your css: "content_css: 'http://mydomain.com/webroot/../content.css'".
Thariama
you may also post a link to a weblocation (if available) so that i could have a look at it
Thariama
where to apply 20 colors in mycontent.css?is it here body,td,pre{} ?
SAK
yes, it is body,tr,pre or simply the classname - depending what you want to apply to which html element: pre { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px;}.example1 { font-weight: bold; font-size: 14px}
Thariama
if it is suitable for you to be able to apply the classes using the stylesplugin (from the dropdown) you only need to extend the initialization for tinymce (use the formats setting you find in the tinymce wiki under configuration)
Thariama