您的位置:首页 > 其它

FCKeditorAPI中文用例说明

2009-05-05 22:49 246 查看
FCKeditorAPI中文用例说明

function abc()

{ var checkContent =FCKeditorAPI.GetInstance("editor");//获取实例

alert(checkContent.GetXHTML());//获取当前内容

var newelement = document.createElement("a");

newelement.href="#";

newelement.innerHTML="df";

checkContent.InsertElement(newelement);//前部添加元素(无返回值)

var a=checkContent.InsertElementAndGetIt(newelement);//前部添加元素(返回元素) checkContent.InsertHtml(" ")//添加html

checkContent.SetHTML(" ",true);//设置内容,后为bool,是否所见即所得 }

function aaa()

{ var checkContent =FCKeditorAPI.GetInstance("editor");//获取实例

checkContent.SwitchEditMode();//转变编辑模式

checkContent.UpdateLinkedField();//更新关联文件

}

function FCKeditor_OnComplete( checkContent )//当加载完

{ alert( checkContent.Name ) ;

} oEditor这个是全局变量,指当前实例,可以用到弹出页中如fck_image.html

创建实例,oEditor.FCKeditorAPI.GetInstance("editor") 也可以用oEditor.FCK,后者更灵活. 返回顶级页 oEditor.parent.parent 如何插入插件参考网站

http://wiki.fckeditor.net/Developer%27s_Guide/Customization/Plug-ins 在plugins里新建个文件夹.如newthing 里面有fckplugin.js newthing.html newthing.gif fckplugin.js

/* FCKCommands.RegisterCommand(commandName, command) commandName - Command name, referenced by the Toolbar, etc... command - Command object (must provide an Execute() function). */ //

Register the related commands. FCKCommands.RegisterCommand( 'newthing', new FCKDialogCommand( '新建的按纽', '新建的按纽页面', FCKConfig.PluginsPath + 'newthing/newthing.html', 340, 170)); // Create the "newthing" toolbar button.

var oFindItem = new FCKToolbarButton('newthing', FCKLang['DlgMyFindTitle']); oFindItem.IconPath = FCKConfig.PluginsPath + 'newthing/newthing.gif' ; // 'newthing' is the name used in the Toolbar config. FCKToolbarItems.RegisterItem( 'newthing', oFindItem ) ; ; newthing.html 内容在上面的灰色代码里. myconfig 加上FCKConfig.Plugins.Add( 'newthing', '' ) ;

如果要打语句,则要新建文件夹 plugins/lang/ 新建文件cn.js 内容如下 FCKLang.DlgMyFindTitle="要村霜要霜"; 刚才在新建按纽时用了这件一句话

var oFindItem = new FCKToolbarButton('newthing', FCKLang['DlgMyFindTitle']); FCKLang['DlgMyFindTitle']值就是"要村霜要霜"; 如果你想写死的话就可以写成

var oFindItem = new FCKToolbarButton('newthing', '要村霜要霜'); "要村霜要霜"会在你鼠标经过按纽时显示最后在你的config.js文件里面写上

FCKConfig.Plugins.Add('newthings','cn') ;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: