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 + "'>");            
            }
        }
    }
    

      

  • 相关阅读:
    markdown with vim
    递归
    类 sizeof
    cppcheck工具
    c++ explicit的含义和用法
    pca主成分分析
    string的使用
    linux的shell进化简史
    adb shell 无法启动 (insufficient permissions for device)
    c++ 四种转换的意思
  • 原文地址:https://www.cnblogs.com/mcho/p/3382875.html
Copyright © 2011-2022 走看看