标签:fck

浏览模式: 标准 | 列表 | 图文
FCK常用操作

FCK常用操作

1、获取编辑器中HTML内容
function getEditorHTMLContents(EditorName)
{
var oEditor = FCKeditorAPI.GetInstance(EditorName);
return(oEditor.GetXHTML(true));
}
2、获取编辑器中文字内容(无html代码)
function getEditorTextContents(EditorName)
{
var oEditor = FCKeditorAPI.GetInstance(EditorName);
return(oEditor.EditorDocument.body.innerText);
}
3、设置编辑器中内容
function SetEditorContents(EditorName, ContentStr)
{
var oEditor = FCKeditorAPI.GetInstance(EditorName) ;
oEditor.SetHTML(ContentStr) ;
}
function InsertHTML(html) {
var oEditor = FCKeditorAPI.GetInstance("editor") ;
if (oEditor.EditMode == FCK_EDITMODE_WYSIWYG ) {
oEditor.InsertHtml(html) ;
}else
alert( "FCK必须处于WYSIWYG模式!" ) ;
}
FCK代码插件的BUG

FCK代码插件的BUG

fck应该是大家用的比较多的所见所得编辑器了,最近被人BS了一上才发现,原来FCK的代码高亮插件有一个很大的BUG,是啥BUG呢?让我们看一下。。。

先输入一段代码:
<?php
if( !empty( $_GET['action'] ) ){
echo 'this is a test';
}
?>

OK,一切正常,下面,我们将这一段拷贝到FCK编辑器里的PHP代码里面。

<?php
if( !emptyempty( $_GET['action'] ) ){
echo 'this is a test';
}
?>

看到了什么??没错,两个empty,好吃惊呀。。。
以后拷贝代码给别人的时候要注意一下了