platform/public/kindeditor/asp.net/demo.aspx

81 lines
3.3 KiB
Plaintext
Raw Normal View History

2024-02-18 23:33:54 +08:00
<%@ Page Language="C#" AutoEventWireup="true" validateRequest="false" %>
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
this.Label1.Text = Request.Form["content1"];
}
</script>
<!doctype html>
<html>
<head runat="server">
<meta charset="utf-8" />
<title>KindEditor ASP.NET</title>
<link rel="stylesheet" href="../themes/default/default.css" />
<link rel="stylesheet" href="../plugins/code/prettify.css" />
<script charset="utf-8" src="../kindeditor-all.js" type="text/javascript"></script>
<script charset="utf-8" src="../lang/zh-CN.js" type="text/javascript"></script>
<script charset="utf-8" src="../plugins/code/prettify.js" type="text/javascript"></script>
<script type="text/javascript">
KindEditor.ready(
function (K) {
editor = K.create('#content1', {
//上传处理程序的路径
uploadJson: '/pubic/KindEditor/asp.net/upload_json.ashx',
imageSizeLimit: '10MB', //批量上传图片单张最大容量
imageUploadLimit: 30, //批量上传图片同时上传最多个数
//文件管理处理程序的路径
fileManagerJson: '/pubic/KindEditor/asp.net/file_manager_json.ashx',
allowFileManager: true,
//要取值设置这里 这个函数就是同步KindEditor的值到textarea文本框
afterCreate: function () {
var self = this;
K.ctrl(document, 13, function () {
self.sync();
K('form[name=example]')[0].submit();
});
K.ctrl(self.edit.doc, 13, function () {
self.sync();
K('form[name=example]')[0].submit();
});
},
//上传后执行的回调函数,获取上传图片的路径
afterUpload: function (data) {
alert(data);
},
//同时设置这里
afterBlur: function () {
this.sync();
},
width: '1000px;',
height: '500px;',
//编辑工具栏
items: [
'source', '|', 'undo', 'redo', '|', 'preview', 'print', 'template', 'code', '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', 'media', 'insertfile', 'table', 'hr', 'emoticons', 'baidumap', 'pagebreak',
'anchor', 'link', 'unlink', '|', 'about'
]
});
});
</script>
</head>
<body>
<asp:Label ID="Label1" runat="server" Text=""></asp:Label>
<form id="example" runat="server">
<textarea id="content1" cols="100" rows="8" style="width:700px;height:200px; " runat="server"></textarea>
<br />
<asp:Button ID="Button1" runat="server" Text="提交内容" /> (提交快捷键: Ctrl + Enter)
</form>
</body>
</html>