国产一级a片免费看高清,亚洲熟女中文字幕在线视频,黄三级高清在线播放,免费黄色视频在线看

打開APP
userphoto
未登錄

開通VIP,暢享免費電子書等14項超值服

開通VIP
.Net在線編輯器:KindEditor及CkEditor配置說明


一、KindEditor

KindEditor是一套開源的HTML可視化編輯器,主要用于讓用戶在網(wǎng)站上獲得所見即所得編輯效果,兼容IE、Firefox、Chrome、Safari、Opera等主流瀏覽器。 KindEditor使用JavaScript編寫,可以無縫的與Java、.NET、PHP、ASP等程序接合。
KindEditor非常適合在CMS、商城、論壇、博客、Wiki、電子郵件等互聯(lián)網(wǎng)應(yīng)用上使用,2006年7月首次發(fā)布2.0以來,KindEditor依靠出色的用戶體驗和領(lǐng)先的技術(shù)不斷擴(kuò)大編輯器市場占有率,目前在國內(nèi)已經(jīng)成為最受歡迎的編輯器之一。

目前最新版本 KindEditor 3.5.2,官網(wǎng)及下載地址

KindEditor配置步驟:

1、在項目中建立KindEditor文件夾,把下載下來后的文件解壓,將其中的skins,plugins,kindeditor.js 拷到該KindEditor文件夾目錄下;

2、在.aspx文件中放入TextBox控件,并設(shè)置控件ID

    如:<asp:TextBox ID="txtContent" TextMode="MultiLine"  runat="server"></asp:TextBox>

3、在.aspx文件中引入kindeditor.js文件及Js代碼,可將TextBox控件設(shè)置成KindEditor在線編輯器,代碼如下:

01<script src="../kindeditor/kindeditor.js" type="text/javascript"></script>
02<script type="text/javascript">
03    KE.show({
04        id: txtContent,
05        imageUploadJson: '/handler/upload_json.ashx',
06        items : [
07        'source''|''fullscreen''undo''redo''print''cut''copy''paste',
08        'plainpaste''wordpaste''|''justifyleft''justifycenter''justifyright',
09        'justifyfull''insertorderedlist''insertunorderedlist''indent''outdent','subscript',
10        'superscript''|''selectall''-',
11        'title''fontname''fontsize''|''textcolor''bgcolor''bold',
12        'italic''underline''strikethrough''removeformat''|''image',
13        'flash''media''advtable''hr''emoticons''link''unlink'
14         ]
15    });
16</script>

其中,id為TextBox控件的ID,imageUploadJson: '/handler/upload_json.ashx'可設(shè)置圖片上傳(文件上傳設(shè)置同理),item為設(shè)置編輯器工具欄上的每一個功能是否顯示,可根據(jù)需要手動增刪對應(yīng)單詞,如不需要“HTML代碼”功能則刪除“'source',”;

4、在.aspx頁面的第一句話及Page指令中加上validaterequest=”false”,禁止.net自動屏蔽上傳Html代碼;

  如:<%@ Page Language="C#" ValidateRequest="false"...

5、設(shè)置完畢,后臺可直接通過TextBox的text屬性來獲取編輯器內(nèi)容;

另:設(shè)置KindEditor的圖片上傳功能
1、在剛才在.aspx頁面中添加的js代碼中添加imageUploadJson參數(shù),

  如:imageUploadJson: '/handler/upload_json.ashx'
2、建立一般處理程序頁面upload_json.ashx,該頁面用于編寫文件上傳代碼,在下載下來的源碼有,在asp.net中,稍作修改,代碼如下:

01using System;
02using System.Collections.Generic;
03using System.Linq;
04using System.Web;
05using System.Collections;
06using System.IO;
07using System.Globalization;
08using LitJson; // 需先手動添加LitJson.dll的引用,在asp.net/bin中
09  
10namespace Yongbin.Shop.Web.handler
11{
12    /// <summary>
13    /// upload_json 的摘要說明
14    /// </summary>
15    public class upload_json : IHttpHandler
16    {
17        //文件保存目錄路徑
18        private String savePath = "/upload/" + DateTime.Now.ToString("yyyyMMdd") + "/";  // 修改上傳目錄
19        //文件保存目錄URL(顯示在kindeditor編輯器中的地址)
20        private String saveUrl = "/upload/" + DateTime.Now.ToString("yyyyMMdd") + "/";
21        //定義允許上傳的文件擴(kuò)展名
22        private String fileTypes = "gif,jpg,jpeg,png,bmp";
23        //最大文件大小
24        private int maxSize = 1000000;
25  
26        private HttpContext context;
27  
28        public void ProcessRequest(HttpContext context)
29        {
30            this.context = context;
31  
32            HttpPostedFile imgFile = context.Request.Files["imgFile"];
33            if (imgFile == null)
34            {
35                showError("請選擇文件。");
36            }
37  
38            String dirPath = context.Server.MapPath(savePath);
39            if (!Directory.Exists(dirPath))
40            {
41                Directory.CreateDirectory(dirPath);  // 復(fù)制過來的代碼改了這里,自動創(chuàng)建目錄
42            }
43  
44            String fileName = imgFile.FileName;
45            String fileExt = Path.GetExtension(fileName).ToLower();
46            ArrayList fileTypeList = ArrayList.Adapter(fileTypes.Split(','));
47  
48            if (imgFile.InputStream == null || imgFile.InputStream.Length > maxSize)
49            {
50                showError("上傳文件大小超過限制。");
51            }
52  
53            if (String.IsNullOrEmpty(fileExt) || Array.IndexOf(fileTypes.Split(','), fileExt.Substring(1).ToLower()) == -1)
54            {
55                showError("上傳文件擴(kuò)展名是不允許的擴(kuò)展名。");
56            }
57  
58            String newFileName = DateTime.Now.ToString("yyyyMMddHHmmss_ffff", DateTimeFormatInfo.InvariantInfo) + fileExt;
59            String filePath = dirPath + newFileName;
60  
61            imgFile.SaveAs(filePath);
62  
63            String fileUrl = saveUrl + newFileName;
64  
65            Hashtable hash = new Hashtable();
66            hash["error"] = 0;
67            hash["url"] = fileUrl;
68            context.Response.AddHeader("Content-Type""text/html; charset=UTF-8");
69            context.Response.Write(JsonMapper.ToJson(hash));
70            context.Response.End();
71        }
72  
73        private void showError(string message)
74        {
75            Hashtable hash = new Hashtable();
76            hash["error"] = 1;
77            hash["message"] = message;
78            context.Response.AddHeader("Content-Type""text/html; charset=UTF-8");
79            context.Response.Write(JsonMapper.ToJson(hash));
80            context.Response.End();
81        }
82  
83        public bool IsReusable
84        {
85            get
86            {
87                return false;
88            }
89        }
90    }
91}



3、配置成功


二、CkEditor
看過一個非官方非正式的關(guān)于.net在線編輯器的使用調(diào)查,CkEditor是被使用做多的,屬于重量級編輯器,功能很強(qiáng)大;

CKEditor是新一代的FCKeditor,是一個重新開發(fā)的版本。CKEditor是全球最優(yōu)秀的網(wǎng)頁在線文字編輯器之一,因其驚人的性能與可擴(kuò)展性而廣泛的被運用于各大網(wǎng)站。

CKEditor 不具備上傳功能,需要集成 文件管理器CKFinder 才能實現(xiàn)上傳功能。)

我這里使用的版本是ckeditor_3.2及ckfinder_aspnet_1.4.3

未完待補(bǔ)充

本站僅提供存儲服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點擊舉報。
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
extjs [文本編輯器:Editor]
KindEditor上傳圖片問題
java中KindEditor本地圖片上傳與上傳失敗問題
Struts2使用Kindeditor4.0.3在線編輯器--上傳圖片、視頻、FLASH、附件
織夢dedecms自帶文本編輯器ckeditor更換為kindeditor編輯器帶代
14款web前端常用的富文本編輯器插件
更多類似文章 >>
生活服務(wù)
分享 收藏 導(dǎo)長圖 關(guān)注 下載文章
綁定賬號成功
后續(xù)可登錄賬號暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點擊這里聯(lián)系客服!

聯(lián)系客服