KindEditor简单的Demo使用

一般的做网站后台都会用到富文本编辑器,网上也有很多优秀的富文本编辑器,这里是开源中国的富文本编辑器推荐:http://www.oschina.net/project/tag/172/wysiwyg

我用过CKeditor比较庞大,这里我用了一个国产开源的富文本编辑器(JS开发)KindEitor官网地址:http://www.kindsoft.net/

开始前我要说下,开发时最好用最新的KindEitor因为网上有文章说KindEitor3.x-4.1有漏洞例如:

http://www.2cto.com/Article/201207/140017.html

http://www.cnseay.com/504/

官方最目前新版的是:4.1.7 请大家去下载:http://www.kindsoft.net/down.php

好了说了这么进入正题:

下载下来是这样的红线标的是要的文件:

把这些文件复制进入你的项目:

对应的前台代码:

复制代码
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="KindEidtor._Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>KindEditor测试Demo</title>
    <%--必须引入的对应CSS和JS--%>
    <link rel="stylesheet" href="Editor/themes/default/default.css" />
    <link rel="stylesheet" href="Editor/plugins/code/prettify.css" />
    <script type="text/javascript" charset="utf-8" src="js/jquery-1.8.2.js"></script>
    <script type="text/javascript" charset="utf-8" src="Editor/kindeditor-min.js"></script>
    <script type="text/javascript" charset="utf-8" src="Editor/lang/zh_CN.js"></script>
    <script type="text/javascript" charset="utf-8" src="Editor/plugins/code/prettify.js"></script>
    <script type="text/javascript" charset="utf-8">
        $(function () {
            var editor = KindEditor.create('textarea[name="txtEditor"]', {
                //上传文件管理
                uploadJson: 'handler/upload_json.ashx',
                //文件管理
                fileManagerJson: 'handler/file_manager_json.ashx',
                //编辑器宽度
                width: '700px',
                //编辑器的显示功能
                items:[
                'source', '|', 'undo', 'redo', '|', 'preview', 'print', 'template', 'cut', 'copy', 'paste',
                'plainpaste', 'wordpaste', '|', 'justifyleft', 'justifycenter', 'justifyright',
                'justifyfull', 'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent', 'subscript',
                'superscript', 'clearhtml', 'quickformat', 'selectall', '|', 'fullscreen', '/',
                'formatblock', 'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold',
                'italic', 'underline', 'strikethrough', 'lineheight', 'removeformat', '|', 'image', 'multiimage',
                'flash','insertfile', 'table', 'hr', 'emoticons', 'baidumap', 'pagebreak',
                'anchor', 'link', 'unlink', '|', 'about'
                ]
                                           
            });
        });
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div style="margin: 20px auto; width: 800px;">
        <asp:TextBox id="txtEditor" runat="server" style="width:750px;height:450px;" TextMode="MultiLine"></asp:TextBox>
    </div>
    </form>
</body>
</html>
复制代码

这个例子只有简单的功能,更的配置请看官方的文档:http://www.kindsoft.net/doc.php

posted @   Java_Swing  阅读(3114)  评论(0编辑  收藏  举报
编辑推荐:
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
阅读排行:
· 周边上新:园子的第一款马克杯温暖上架
· Open-Sora 2.0 重磅开源!
· 分享 3 个 .NET 开源的文件压缩处理库,助力快速实现文件压缩解压功能!
· Ollama——大语言模型本地部署的极速利器
· DeepSeek如何颠覆传统软件测试?测试工程师会被淘汰吗?
点击右上角即可分享
微信分享提示