当前位置: 代码迷 >> Web前端 >> FCKeditor 配备
  详细解决方案

FCKeditor 配备

热度:428   发布时间:2012-11-23 22:54:33.0
FCKeditor 配置
在jsp页面调用FCKeditor:
?导入4个包,其中一个核心的jar包:fckeditor-core-java.jar?
?这里面有在jsp页面使用的标签,通过里面的<FCK:editor>这个
?标签来生成FCK在线编辑器.
?Example:
??<FCK:editor instanceName="editorDefault" basePath="/fckeditor" value=" " height="500px" />
??具体配置属性查看文档.
?PS:basePath以'/'开头,并且这个'/'代表当前工程的路径.
??? value:一定要设置value属性的值,并且值不能是空字符串.
===================================================
配置FCKeditor中的参数:
?fckeditor下面的fckconfig.js这个文件是FCKeditor的主配置文件.
?可以自定一个配置文件,覆盖主配置文件中的部分配置项.
?
?1.是否自动检测本地语言来显示编辑器
?FCKConfig.AutoDetectLanguage= true ;
?2.默认编辑器显示的语言
?FCKConfig.DefaultLanguage= 'en' ;
?指定FCKeditor使用的配置文件:
?方法一:
??在fckconfig.js中:
??FCKConfig.CustomConfigurationsPath = '/myconfig.js' ;
??设置为自定义的配置配置文件.
??作用域:对所有实例都有效.
?方法二:
??var oFCKeditor = new FCKeditor("fckeditor");
??oFCKeditor.Config["CustomConfigurationsPath"] =? "/myconfig.js"
??作用域:只对当前的实例有效.
?方法三:
??直接修改主配置文件,最好不要这样做.
?PS:都是相对路径. web工程名/文件夹/myconfig.js

?配置文件加载顺序:
??1,加载主配置文件fckconfig.js.
??2,加载自定义的配置文件(如果有),覆盖相同的配置项.
??3,是哦你个实例的配置覆盖相同的配置项(只对当前的实例有效.)
==========================================================================
自定义ToolbarSet(编辑器中的工具集):
?这个是编辑器中的所有功能:
??FCKConfig.ToolbarSets["Default"] = [
???['Source','DocProps','-','Save','NewPage','Preview','-','Templates'],
???['Cut','Copy','Paste','PasteText','PasteWord','-','Print','SpellCheck'],
???['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'],
???['Form','Checkbox','Radio','TextField','Textarea','Select','Button','ImageButton','HiddenField'],
???'/',
???['Bold','Italic','Underline','StrikeThrough','-','Subscript','Superscript'],
???['OrderedList','UnorderedList','-','Outdent','Indent','Blockquote','CreateDiv'],
???['JustifyLeft','JustifyCenter','JustifyRight','JustifyFull'],
???['Link','Unlink','Anchor'],
???['Image','Flash','Table','Rule','Smiley','SpecialChar','PageBreak'],
???'/',
???['Style','FontFormat','FontName','FontSize'],
???['TextColor','BGColor'],
???['FitWindow','ShowBlocks','-','About']
??];
?'/' : 表示换行.
?'-' : 分隔符.编辑器中使用'|'将相邻的两个功能分开.
?需要自己配置一个工具集,可以在自定义的配置文件中配置.
加上几种常用的字体:
?对这个进行修改:
?FCKConfig.FontNames = 'Arial;Comic Sans MS;Courier New;Tahoma;Times New Roman;Verdana';
?FCKConfig.FontNames = '宋体;楷体_GB2312;黑体;隶书;Times New Roman;Arial';
回车的模式修改:
?FCKConfig.EnterMode = 'p'; // p | div | br??? 只能指定这三种
?FCKConfig.ShiftEnterMode = 'br'; // p | div | br? 只能指定这三种
表情图片的配置:
?FCKConfig.SmileyPath?= FCKConfig.BasePath + 'images/smiley/msn/' ; //表情库路径
?FCKConfig.SmileyImages?= ['regular_smile.gif','sad_smile.gif','wink_smile.gif'] ;//添加的图片,配置这个里面.
?FCKConfig.SmileyColumns = 8 ; //列宽 (每个表情之间的距离)
?FCKConfig.SmileyWindowWidth??= 320 ; //点击添加表情时,弹出的选择表情窗口的宽
?FCKConfig.SmileyWindowHeight?= 210 ;
?PS:
???? FCKConfig.BasePath 为"/fckeditor/editor/" 这个路径
???? FCKConfig.EditorPath 为/fckeditor/? 这个路径.
?如果表情太多,需要去修改弹出窗口的html文件,让弹出窗口大小适合.
  相关解决方案