zoukankan      html  css  js  c++  java
  • FCKeditor如何升级CKEditor及使用方法

    之前编辑器用的是FCKeditor,因为项目原因需要升级为最新版本4.2.2,发现是已经更名为CKEditor。

    百度了一下,据官方的解释,CK是对FCK的代码的完全重写。

    项目环境是asp.net的,之前用的FCKeditor版本是2.6。

    在aspx文件头需要引用FCK的名为FredCK.FCKeditorV2.dll文件。

    <%@ Register Assembly="FredCK.FCKeditorV2" Namespace="FredCK.FCKeditorV2" TagPrefix="FCKeditorV2" %>

     使用控件如下写法:

    <FCKeditorV2:FCKeditor ID="fckContent" runat="server" Width="100%" BasePath="~/editor/" />

    在.cs文件里要取得该控件值:fckContent.Value

    升级为CKEditor后,有2种方法使用

    第一种:去CKEditor官网找到下载CKEditor  for ASP.NET ,目前版本是3.6.4。

               解压压缩包,找到CKEditor.NET.dll,放到项目的bin目录下

               aspx文件头引用写上:

    <%@ Register Assembly="CKEditor.NET" Namespace="CKEditor.NET" TagPrefix="CKEditor" %>

               使用控件:

    <CKEditor:CKEditorControl runat ="server" ID="ckContent" BasePath="~/editor/"></CKEditor:CKEditorControl> 

               .cs文件里取得该控件值:ckContent.Text

               其中的BasePath是CKEditor的包文件所在目录。(本人亲测:包文件版本放的4.2.2也是可以使用的。)

    第二种:aspx文件里head里直接引用js文件:

    <script type="text/javascript" src="../ckeditor/ckeditor.js"></script>

               body里写上如下即可(下面的script一定要在控件之下,放在head里不管用)

    <asp:TextBox name="ckContent" id="ckContent" runat="server" TextMode="MultiLine" Width="300px" Height="60px" CssClass="input"/> 
    
    <script type="text/javascript"> 
    
    CKEDITOR.replace( 'ckContent');
    </script>
    

    升级全部完工。

    另外附上项目中的如何在CKEditor里插入外部图片写法:

    function OpenDialogPageForckEdit()
    {
        var uri = '';
        var param = '';
        var oEditor = CKEDITOR.instances.ckContent;
        uri = 'V5Mall_Picture_Dailog.aspx?isfck=1&d=' + Date();
        if (navigator.appVersion.indexOf("MSIE") == -1)
        {
            this.returnAction = function(strResult)
            {
                if(strResult != null)
                {
                    oEditor.insertHtml(GetValue);
    				
                }
            }
            param = 'alwaysRasied=yes,modal=yes,width=620,height=800,top=100,left=200,resizable=no,scrollbars=no';
            var GetValue=window.showModalDialog(uri, '_blank', param);
            oEditor.insertHtml("<img src='" + GetValue + "'>"); 
            return;
        }
        else
        {         
            //param = 'dialogWidth:550px;dialogHeight:550px;';   
            param = 'alwaysRasied=yes,modal=yes,width=620,height=800,top=100,left=200,resizable=no,scrollbars=no';    
            var GetValue = window.showModalDialog(uri, '_blank', param);        
            if (GetValue != null)
            {
                oEditor.InsertHtml("<img src='" + GetValue + "'>");            
            }
        }
    }
    

      

  • 相关阅读:
    github not authorized eclipse 关于 代码不能提交到GitHub
    idea 导入项目后 有的项目目录结构不展开解决办法
    intellij idea 主题大全,看不惯idea 那2种主题的来这里了
    win10 系统输入法与 idea的 ctr+shift+f 快捷键冲突,解决办法
    此地址使用了一个通常用于网络浏览以外目的的端口。出于安全原因,Firefox 取消了该请求。
    关于IntelliJ IDEA有时候快捷键无效的说明
    杜恩德是谁?
    oracle如何连接别人的数据库,需要在本地添加一些配置
    2.6---找有环链表的开头结点(CC150)
    2.3---删除链表的结点,不提供头结点(CC150)
  • 原文地址:https://www.cnblogs.com/mcho/p/3382875.html
Copyright © 2011-2022 走看看