FCKEditor网页编辑器 几点使用心得
更新时间:2009年10月27日 22:08:56 作者:
FCKEditor网页编辑器 几点使用心得,需要的朋友可以参考下。
1、挂接事件,比如onkeydown事件,要在FCKeditor_OnComplete里实现:
function FCKeditor_OnComplete( editorInstance )
{
if (document.all) // IE
editorInstance.EditorDocument.attachEvent("onkeypress", FCKeditor_OnKeyup) ;
else// other browser
editorInstance.EditorDocument.addEventListener( 'onkeypress', FCKeditor_OnKeyup, true );
}
2、挂接后如果调用了fckeditor的SetHTML函数,则挂接事件会失效,要改用oEditor.EditorDocument.body.innerHTML来设置内容即可。
3、用window.event.keyCode只能取到null值,要用FCKeditorAPI.GetInstance('FCKeditor1').EditorWindow.event.keyCode。
4、按回车符后生成的是是<br>还是<p>由fckconfig.js文件里的FCKConfig.EnterMode/FCKConfig.ShiftEnterMode决定,也可动态设置但属性名不是FCKConfig,而是Config。
复制代码 代码如下:
function FCKeditor_OnComplete( editorInstance )
{
if (document.all) // IE
editorInstance.EditorDocument.attachEvent("onkeypress", FCKeditor_OnKeyup) ;
else// other browser
editorInstance.EditorDocument.addEventListener( 'onkeypress', FCKeditor_OnKeyup, true );
}
2、挂接后如果调用了fckeditor的SetHTML函数,则挂接事件会失效,要改用oEditor.EditorDocument.body.innerHTML来设置内容即可。
3、用window.event.keyCode只能取到null值,要用FCKeditorAPI.GetInstance('FCKeditor1').EditorWindow.event.keyCode。
4、按回车符后生成的是是<br>还是<p>由fckconfig.js文件里的FCKConfig.EnterMode/FCKConfig.ShiftEnterMode决定,也可动态设置但属性名不是FCKConfig,而是Config。
相关文章
常用的HTML富文本编译器UEditor、CKEditor、TinyMCE、HTMLArea、eWebEditor、Ki
这篇文章主要介绍了常用的HTML富文本编译器UEditor、CKEditor、TinyMCE、HTMLArea、eWebEditor、KindEditor简介,需要的朋友可以参考下2017-03-03FCK判断内容是否为空(如果只是去空格,那么这种方式是错误的)
一般来说,像input里面的值都可以通过将内容去空格判断是否为空,但是FCK没那么简单,因为当你多打几个空格或者多打一些回车,它会自动地生成一些<p>标签,如果再用原先去空格判断的方法,显然是不可取的。2010-12-12
最新评论