KindEditor簡單的Demo使用

通常的作網站後臺都會用到富文本編輯器,網上也有不少優秀的富文本編輯器,這裏是開源中國的富文本編輯器推薦:http://www.oschina.net/project/tag/172/wysiwygjavascript

我用過CKeditor比較龐大,這裏我用了一個國產開源的富文本編輯器(JS開發)KindEitor官網地址:http://www.kindsoft.net/php

開始前我要說下,開發時最好用最新的KindEitor由於網上有文章說KindEitor3.x-4.1有漏洞例如:css

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

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

官方最目前新版的是:4.1.7 請你們去下載:http://www.kindsoft.net/down.phpjquery

好了說了這麼進入正題:json

下載下來是這樣的紅線標的是要的文件:編輯器

把這些文件複製進入你的項目:測試

對應的前臺代碼:網站

<%@ 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

相關文章
相關標籤/搜索