欢迎访问 生活随笔!

生活随笔

当前位置: 首页 > 人文社科 > 生活经验 >内容正文

生活经验

FCKeditor如何升级CKEditor及使用方法

发布时间:2023/11/27 生活经验 42 豆豆
生活随笔 收集整理的这篇文章主要介绍了 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 + "'>");            }}
}

  

转载于:https://www.cnblogs.com/mcho/p/3382875.html

总结

以上是生活随笔为你收集整理的FCKeditor如何升级CKEditor及使用方法的全部内容,希望文章能够帮你解决所遇到的问题。

如果觉得生活随笔网站内容还不错,欢迎将生活随笔推荐给好友。