fckediterAPI

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
    <head>
        <title></title>
        <META http-equiv="Content-Type" content="text/html; charset=utf-8">
        <meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
        <meta content="VisualStudio.HTML" name="ProgId">
        <meta content="Microsoft Visual Studio .NET 7.1" name="Originator">
        <script type="text/javascript">

var oEditor = window.parent.InnerDialogLoaded() ;


window.onload = function OnLoad()
{
    // First of all, translate the dialog box texts
   
    oEditor.FCKLanguageManager.TranslatePage( document ) ;

    window.parent.SetAutoSize( true ) ;

    oEditor.FCKUndo.SaveUndoStep() ;
    window.parent.SetOkButton( true ) ;
}

function Ok()
{
   

    return true ;
}

 

 

        </script>
    </head>
    <body>
        <div id="a"><FONT face="宋体"></FONT></div>
        <script language="javascript">
a.innerHTML=oEditor.FCK.EditorDocument.body.innerHTML;
//注意这里用innerHTML会有url解析的问题应该用
 var checkContent =oEditor.FCKeditorAPI.GetInstance("editor");//获取实例<BR>
 checkContent.SetHTML(endtxt);
        </script>
    </body>
</html>
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("<input tyep='text'>")//添加html
   checkContent.SetHTML("<input tyep='text'>",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') ;
就可以了

 

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值