FCKeditor自定义编辑区CSS样式

在网站后台使用FCKeditor编辑器的时候,见到的效果可能并不完全是”所见即所得”的,因为如果在FCKeditor编辑区中使用了前台样式表中的样式,在编辑区中并不能把这些样式显示出来.解决这个问题的办法就是,在FCKeditor初始化的时候导入自定义的CSS样式.

具体的代码如下(相关解释见注释):

window.onload = function(){
var sBasePath = ‘/fckeditor/’;//fckeditor的绝对路径
var SitePath = ‘/mysite/’;//网站的绝对路径
var oFCKeditor = new FCKeditor(‘content’);//’content’为多行文本框的名字
oFCKeditor.BasePath = sBasePath;
oFCKeditor.Config['EditorAreaCSS'] = SitePath + ‘css/style.css’ ;//’css/style.css’为网站前台的样式表
oFCKeditor.Width = ’100%’ ;
oFCKeditor.Height = ’450′ ;
oFCKeditor.ReplaceTextarea() ;
}

注:在asp.net中,可以直接设置,如下:

Content.EditorAreaCSS = "/style/base.css";

原文地址:https://www.cnblogs.com/superfeeling/p/3372250.html