FckEditor的主配置文件为 fckconfig.js,但一般不更改它而是创建一个附加的配置文件myConfig.js,文件需为UTF-8编码保存
1.创建myConfig.js并放在工程目录的WebRoot下,并放置以下内容
//自动检测浏览器语言,当为false时,使用下面默认语言
//en-英语 fr-法语 zh-cn中文
FCKConfig.AutoDetectLanguage = true ;
FCKConfig.DefaultLanguage = 'en' ;
2.配置附加文件,两种方法
第一种:修改fckconfig.js
FCKConfig.CustomConfigurationsPath = '/工程名/myConfig.js' ;
第二种:在创建的时候传入参数
var oFCKeditor = new FCKeditor( "FCKeditor1" ) ;
oFCKeditor.Config["CustomConfigurationsPath"] = "/工程名/myconfig.js" ;
oFCKeditor.Create() ;
为了队止浏览器缓存可以用下面方法
var oFCKeditor = new FCKeditor( "FCKeditor1" ) ;
oFCKeditor.Config["CustomConfigurationsPath"] = "/myconfig.js?" + ( new Date() * 1 ) ;
oFCKeditor.Create() ;
二。自定义工具集
帮助文档:http://docs.cksource.com/FCKeditor_2.x/Developers_Guide/Configuration/Toolbar
参照fckconfig.js中的FCKConfig.ToolbarSets["Default"]
'-'为一个分隔符 '/'为换行
可以把代码拷到myconfig.js中,并对照界面去掉相应的配置。
三。自定义字体
拷贝FCKConfig.FontNames到myconfig.js中,如增加 宋体;黑体;楷体
四。修改回车换行
FCKConfig.EnterMode = 'p' ; // p | div | br
FCKConfig.ShiftEnterMode = 'br' ; // p | div | br
五。配置表情图片
//修改fckeditor/dialog/fck_smiley.html 里dialog.SetAutoSize( false ) ;并且设置 body style="overflow: hidden" -> auto
FCKConfig.SmileyPath = FCKConfig.BasePath + 'images/smiley/qq/' ;
FCKConfig.SmileyImages = ['0.gif','1.gif','10.gif','100.gif','101.gif','102.gif','103.gif','104.gif','105.gif','106.gif','107.gif','108.gif','109.gif','11.gif','110.gif','111.gif','112.gif','113.gif','114.gif','115.gif','116.gif','117.gif','118.gif','119.gif','12.gif','120.gif','121.gif','122.gif','123.gif','124.gif','125.gif','126.gif','127.gif','128.gif','129.gif','13.gif','130.gif','131.gif','132.gif','133.gif','134.gif','14.gif','15.gif','16.gif','17.gif','18.gif','19.gif','2.gif','20.gif','21.gif','22.gif','23.gif','24.gif','25.gif','26.gif','27.gif','28.gif','29.gif','3.gif','30.gif','31.gif','32.gif','33.gif','34.gif','35.gif','36.gif','37.gif','38.gif','39.gif','4.gif','40.gif','41.gif','42.gif','43.gif','44.gif','45.gif','46.gif','47.gif','48.gif','49.gif','5.gif','50.gif','51.gif','52.gif','53.gif','54.gif','55.gif','56.gif','57.gif','58.gif','59.gif','6.gif','60.gif','61.gif','62.gif','63.gif','64.gif','65.gif','66.gif','67.gif','68.gif','69.gif','7.gif','70.gif','71.gif','72.gif','73.gif','74.gif','75.gif','76.gif','77.gif','78.gif','79.gif','8.gif','80.gif','81.gif','82.gif','83.gif','84.gif','85.gif','86.gif','87.gif','88.gif','89.gif','9.gif','90.gif','91.gif','92.gif','93.gif','94.gif','95.gif','96.gif','97.gif','98.gif','99.gif'] ;
//每行显示几个表情
FCKConfig.SmileyColumns = 8 ;
//图片的宽度和高度
FCKConfig.SmileyWindowWidth = 500 ;
FCKConfig.SmileyWindowHeight = 400 ;