在 TinyMCE 中应用 css [英] Applying css in TinyMCE

查看:51
本文介绍了在 TinyMCE 中应用 css的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在 TinyMCE 富文本编辑器中实现 ForeColor.

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>.

我想在这里应用 css 类而不是样式".如何在这里应用 css 类?这些 Css 类包含颜色代码.

i want to apply css class instead of "style" here.. how to apply css class here? These Css Classes contain ColorCodes.

示例:

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

我的 CSS 类

.colorRed
{
color: #ff0000;
}

谢谢

推荐答案

因为您希望将 css 应用于 tinymces 编辑器内容,所以您需要将您的类添加到编辑器内容的样式中.

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.

如果您在初始化 tinymce (init-function) 时没有使用用户定义的 content_css 文件,则将根据您在 init 函数中设置的主题使用 content_css 文件(使用的文件位于文件夹主题).

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).

我建议您创建一个自己的 content.css,您可以使用 init 函数中的 content_css 设置加载它.请参阅 此链接 了解有关此的 tinymce 文档.第一步,您可以从 themes 目录中复制一个 content.css 并对其进行修改.

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.

这篇关于在 TinyMCE 中应用 css的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆