1 jsp中如何使用ckeditor
把ckeditor加压,添加到项目指定目录
jsp页面加入ckeditor.js链接
在js标签内加入 CKEDITOR.replace('messageContent'); 替换testarea
2 ckeditor如何配置
全局配置 修改配置文件 config.js
CKEDITOR.editorConfig = function( config )
{
config.language = 'fr';
config.uiColor = '#AADC6E';
};
页面配置 当页有效
CKEDITOR.replace( 'messageContent',
{
toolbar : 'Basic',
uiColor : '#9AB8F3'
});
写自己的配置文件,在页面引入
CKEDITOR.replace( 'messageContent',
{
customConfig : '/custom/ckeditor_config.js'
});
3 删掉ckeditor没用的文件
/_samples :示例文件夹;
/_source :未压缩源程序;
/lang文件夹下除 zh-cn.js、en.js 以外的文件(也可以根据需要保留其他语言文件);
根目录下的 changes.html(更新列表),install.html(安装指向),license.html(使用许可);
/skins 目录下不需要的皮肤,一般用V2(简单,朴素) ,如果只保留V2则必须在config.js中指定皮肤。
4 toolbar
下面是所有的配置项,可以自定义扩充,删改
toolbar :
[
//加粗 斜体, 下划线 穿过线 下标字 上标字
['Bold','Italic','Underline','Strike','Subscript','Superscript'],
// 数字列表 实体列表 减小缩进 增大缩进
['NumberedList','BulletedList','-','Outdent','Indent'],
//左对齐 居中对齐 右对齐 两端对齐
['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],
//超链接 取消超链接 锚点
['Link','Unlink','Anchor'],
//图片 flash 表格 水平线 表情 特殊字符 分页符
['Image','Flash','Table','HorizontalRule','Smiley','SpecialChar','PageBreak'],
'/',
// 样式 格式 字体 字体大小
['Styles','Format','Font','FontSize'],
//文本颜色 背景颜色
['TextColor','BGColor'],
//全屏 显示区块
['Maximize', 'ShowBlocks','-','About']
]
}
5 浏览器兼容性问题 谷歌浏览器 CKEDITOR.editorConfig = function( config ) { };必须写入config.js才生效,写入其它js文件无效