KindEditor 编辑器前台得使用规范
官方网址:http://www.kindsoft.net/
下载网址:http://www.kindsoft.net/down.php
引入得脚本:
<link href="~/Content/kindeditor/themes/default/default.css" rel="stylesheet" />
<script src="~/Content/kindeditor/kindeditor-all.js"></script>
<script src="~/Content/kindeditor/plugins/code/prettify.js"></script>
<script src="~/Content/JS/KindEditor.js"></script>
html:
@Html.TextAreaFor(model => model.Content, new
{
id = "content1",
cols = "100",
rows = "8",
Style = "width:99%;height:370px;visibility:hidden;"
})
KindEditor.js
KindEditor.ready(function (K) {
var editor1 = K.create('#content1', {
uploadJson: '/Home/UploadImage',
fileManagerJson: '../asp.net/file_manager_json.ashx',
allowFileManager: false,
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();
});
}
});
prettyPrint();
});
Home/UploadImage:
public ActionResult UploadImage()
{
string savePath = "/Upload/";
string saveUrl = "/Upload/";
string fileTypes = "gif,jpg,jpeg,png,bmp,zip,rar,pdf,doc ";
int maxSize = ;
Hashtable hash = new Hashtable();
HttpPostedFileBase file = Request.Files["imgFile"];
if (file == null)
{
hash = new Hashtable();
hash["error"] = ;
hash["url"] = "请选择文件";
return Json(hash);
}
string dirPath = Server.MapPath(savePath);
if (!Directory.Exists(dirPath))
{
hash = new Hashtable();
hash["error"] = ;
hash["url"] = "上传目录不存在";
return Json(hash);
} string fileName = file.FileName;
string fileExt = Path.GetExtension(fileName).ToLower();
ArrayList fileTypeList = ArrayList.Adapter(fileTypes.Split(','));
if (file.InputStream == null || file.InputStream.Length > maxSize)
{
hash = new Hashtable();
hash["error"] = ;
hash["url"] = "上传文件大小超过限制";
return Json(hash);
}
string newFileName = DateTime.Now.ToString("yyyyMMddHHmmss_ffff", DateTimeFormatInfo.InvariantInfo) + fileExt;
string filePath = dirPath + newFileName;
file.SaveAs(filePath);
string fileUrl = saveUrl + newFileName;
hash = new Hashtable();
hash["error"] = ;
hash["url"] = fileUrl;
return Json(hash, "textml;charset=UTF-8"); ;
}
KindEditor 编辑器前台得使用规范的更多相关文章
- Django项目开发,XSS攻击,图片防盗链,图片验证码,kindeditor编辑器
目录 一.Django项目开发 1. 项目开发流程 2. auth模块的补充 (1)django的admin可视化管理页面 (2)将admin可视化管理页面的模型表显示成中文 (3)auth模块的用户 ...
- 如何在一个页面添加多个不同的kindeditor编辑器
kindeditor官方下载地址:http://kindeditor.net/down.php (入门必看)kindeditor官方文档:http://kindeditor.net/doc.ph ...
- kindeditor编辑器里面 filterMode为false时候,允许输入任何代码
kindeditor编辑器里面 filterMode为false时候,允许输入任何代码
- Kindeditor 编辑器POST提交的时候会出现符号被转换
Kindeditor编辑器输入符号单引号,双引号,斜杠 都会被转义 解决办法 $date['content']=$this->textString($_POST['content']); pub ...
- KindEditor编辑器在ASP.NET中的使用
KindEditor编辑器在ASP.NET中的使用 最近做的项目中都有用到富文本编辑器,一直在寻找最后用的富文本编辑器,之前用过CKEditor,也用过UEditor,这次打算用 一下KindEdit ...
- 如何自定义kindeditor编辑器的工具栏items即去除不必要的工具栏或者保留部分工具栏
kindeditor编辑器的工具栏主要是指编辑器输入框上方的那些可以操作的菜单,默认情况下编辑器是给予了所有的工具栏.针对不同的用户,不同的项目,不同的环境,可能就需要保留部分工具栏.那么我们应该如何 ...
- kindeditor编辑器代码过滤解决方法.
很多朋友在使用Kindeditor编辑器的时候都会遇到这样一个问题,如:给A标签加上title属性过后,浏览的时候,却神奇般地发现title属性没有了.再次切换html源代码的时候,返现编辑器将tit ...
- 详细介绍如何使用kindEditor编辑器
今天群里的朋友问我能不能写个kindEditor编辑器的使用教程,说是弄了半天没有搞定.由于PHP啦后台正好用了这个编辑器,我有写经验,正好教他的同时写出来分享给大家. kindEditor编辑器是一 ...
- ThinPHP第二十八天(F函数和file_put_contents区别|PHP生成PHP文件,Kindeditor编辑器使用方法)
1.F(name,data,path)函数和file_put_contents(file,str)区别 F函数直接生成<?php ?>格式的php文件了,将data加入到<?php和 ...
随机推荐
- LeetCode 面试题18. 删除链表的节点
题目链接:https://leetcode-cn.com/problems/shan-chu-lian-biao-de-jie-dian-lcof/ 给定单向链表的头指针和一个要删除的节点的值,定义一 ...
- vue_day01
Vue_day01 1. 认识vue 1.1 什么是vue (1)Vue是构建界面的渐进式的js框架 (2)只关注视图层, 采用自底向上增量开发的设计. (3)Vue 的目标是通过尽可能简单的 API ...
- Java之CheckedException
先来科普一下 CE 到底是什么吧.Java 要求你必须在函数的类型里面声明它可能抛出的异常.比如,你的函数如果是这样: void foo(string filename) throws FileNot ...
- MySQL学习 2019-12-30
启动mysql服务: net start mysql 关闭mysql服务: net stop mysql cmd清屏: cls mysql -V 输出版本信息并且退出 mysql -u 用户名 mys ...
- 分库分表技术演进&最佳实践
每个优秀的程序员和架构师都应该掌握分库分表,这是我的观点. 移动互联网时代,海量的用户每天产生海量的数量,比如: 用户表 订单表 交易流水表 以支付宝用户为例,8亿:微信用户更是10亿.订单表更夸张, ...
- ssh 或 putty 连接linux报错解决方法
由于当天多次输入错误密码,ssh和putty就连接不上了,纠结了很久解决问题 ssh连接提示错误:server unexpectedly closed network connection putty ...
- 本地连接mysql的url写法
一.jdbc:mysql:///中三条斜杠(///) 第三个/代表什么? jdbc:mysql:///testdatabase等同于 jdbc:mysql://localhost:3306/testd ...
- thinkphp论坛项目开发
效果图 首先是数据库 /* Navicat MySQL Data Transfer Source Server : xm Source Server Version : 50553 Source Ho ...
- C#Linq的10个练习
1.LINQ的两种语法 LINQ查询时有两种语法可供选择:查询表达式(Query Expression)和方法语法(Fluent Syntax). .NET公共语言运行库(CLR)并不具有查询表达式的 ...
- Hbase架构剖析
HBase隶属于hadoop生态系统,它参考了谷歌的BigTable建模,实现的编程语言为 Java, 建立在hdfs之上,提供高可靠性.高性能.列存储.可伸缩.实时读写的数据库系统.它仅能通过主键( ...