CKEditor、ckfinder 随笔

CKEditor 提速:禁用拼写检查

ckeditor 的自动拼写检查功能(通过与svn.spellchecker.net网站交互完成),使得 ckeditor 的装载非常的慢,有时显得录入反应相当的慢。拼写检查对于中文是多余了,所以可以把此功能屏蔽掉。官方网站的说法是 Scayt' (spell checker as yout type)

 

修改 ckeditor_3.3.1\config.js ( 以此版本为例 )

CKEDITOR.editorConfig = function( config )
{
        ......
	config.disableNativeSpellChecker = false ;
	config.scayt_autoStartup = false;
	......
};

 

下面是官网对这两个参数的说明( docs.cksource.com ):

参数 disableNativeSpellChecker 的说明

Disables the built-in spell checker while typing natively available in the browser (currently Firefox and Safari only).

Even if word suggestions will not appear in the CKEditor context menu, this feature is useful to help quickly identifying misspelled words.
This setting is currently compatible with Firefox only due to limitations in other browsers.

 

参数 scayt_autoStartup 的说明

If enabled (true), turns on SCAYT automatically after loading the editor.

 

 

CKEditor 增加字体:

修改ckeditor\config.js

 

CKEDITOR.editorConfig = function( config )
{
    config.font_names = '宋体/宋体;黑体/黑体;仿宋/仿宋_GB2312;楷体/楷体_GB2312;隶书/隶书;幼圆/幼圆;'+ config.font_names ;
};

其中,楷体/楷体_GB2312,表示在ckeditor中的字体显示名称为“楷体”,系统字体名称为“楷体_GB2312”。

 


CKEditor 添加自定义字体:

修改ckeditor\config.js

config.contentsCss = 'fonts.css';
//  添加新的字体到 CKEditor 的字体列表
config.font_names = 'fontnametodisplay/yourfontname;' + config.font_names;
 

在 fonts.css 中添加@font-face 属性:

@font-face {  
    font-family: "yourfontname";  
    src: url( ../fonts/font.eot ); /* IE */  
    src: local("realfontname"), url("../fonts/font.TTF") format("truetype"); /*non-IE*/  
}

 

 

CKEditor 存值/取值(客户端)

 

 

设置值:

 

 

// 修改内容
CKEDITOR.instances.content.setData( '编辑的文字' );

// 插入图片 
CKEDITOR.instances.content.insertHtml("<img src=...>");

 

 

读取值:

 

 

 var txt = CKEDITOR.instances.content.getData(  );

 

 

参考:

CKEditor/FCKEditor取值 赋值

 

 

 

IE7/8下报错:存储空间不足,无法完成此操作

 

 

在IE下打开使用 ckeditor 的页面时 IE 报错:存储空间不足,无法完成此操作( Not enough storage is available to complete this operation)。

 

原因之一是因为 ckeditor 如果可能的话就使用 IE 指定文档.createStyleSheet ,但不幸的是,如果样式表超过31的话,它就会出错。

 

解决办法:合并样式。例如,在 joomla 中或 drupal 中,打开样式合并功能开关。也可以在 js 文件中查找 .createStyleSheet 修改相应的代码来解决。

 

// 原代码

if(this.$.createStyleSheet)this.$.createStyleSheet(k)

// 替换为 

if(false)this.$.createStyleSheet(k)
 

 

 

 

参考:Another IE surpriseNot enough storage error in IE7/IE8

 

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值