码迷,mamicode.com
首页 > Web开发 > 详细

asp.net中两款文本编辑器NicEdit和Kindeditor

时间:2014-09-13 00:39:04      阅读:299      评论:0      收藏:0      [点我收藏+]

标签:style   blog   http   color   io   os   使用   java   ar   

 
分类: C#/ASP.Net

目录(?)[+]

做过Web开发的朋友相信都使用过富文本编辑器,比较出名的CuteEditorCKEditor很多人应该已经使用过,在功能强大的同时需要加载的东西也变得很多。下面要推荐的两款富文本编辑器都是使用JS编写,使用简单,非常轻量级。

NicEditor

NicEdit是一个轻量级,跨平台的Inline Content Editor。NicEdit能够让任何 element/div变成可编辑或者能够把标准的TextArea转换成富文本编辑器。

主页:http://nicedit.com/

下载:http://nicedit.com/download.php

示例:http://nicedit.com/demos.php

NicEdit是我见过最轻量级的富文本编辑器,总共就一个JS文件和一张图片

bubuko.com,布布扣

使用也非常简单,只需在页面中添加简单的JS代码就可以将TextBox或是TextArea控件转换成富文本编辑器,代码如下

<head runat="server">
    <title>title>
head>
<body>
    <form id="form1" runat="server">
        <script src="../JS/Eidtor/nicEdit.js" type="text/javascript">script>
        <script type="text/javascript">
            bkLib.onDomLoaded(function() {
                new nicEditor({ fullPanel: true }).panelInstance(‘txtContent‘);
            });
        script>
        <asp:TextBox runat="server" ID="txtContent"
            TextMode="MultiLine" Height="200px" Width="600px" >asp:TextBox>
    form>
body>
html>

运行效果如下

bubuko.com,布布扣

官网中的版本为英文版,而且字体设置也只能设置英文字体,我对英文版本做了简单的汉化,并且增加了几种中文字体,如下图

bubuko.com,布布扣

KindEditor

KindEditor是一套开源的HTML可视化编辑器,主要用于让用户在网站上获得所见即所得编辑效果,兼容IE、Firefox、 Chrome、Safari、Opera等主流浏览器。 KindEditor使用JavaScript编写,可以无缝的与Java、.NET、PHP、ASP等程序接合。这个是官网上的介绍。

主页:http://www.kindsoft.net/index.php

下载:http://www.kindsoft.net/down.php

示例:http://www.kindsoft.net/demo.php

KindEditor相比较NicEditor涉及的文件要多很多,不过大小也才几百K而已,下图为文件结构

bubuko.com,布布扣

使用代码

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>title>
head>
<body>
    <form id="form1" runat="server">
    <script charset="utf-8" src="../JS/KindEditor/kindeditor-min.js" 
             type="text/javascript">script>
    <script type="text/javascript" charset="utf-8">
        KE.show({
            id: ‘txtContent‘,
            resizeMode: 1,
            allowPreviewEmoticons: false,
            allowUpload: false,
        });
    script>
    <textarea cols="60" id="txtContent" style="width: 600px; height: 300px;" runat="server"
        readonly="readonly">textarea>
    form>
body>
html>

运行效果如下

bubuko.com,布布扣

asp.net中两款文本编辑器NicEdit和Kindeditor

标签:style   blog   http   color   io   os   使用   java   ar   

原文地址:http://www.cnblogs.com/xhety/p/3969351.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!