博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
kindeditor富文本编辑器的使用
阅读量:4306 次
发布时间:2019-06-06

本文共 1746 字,大约阅读时间需要 5 分钟。

1.<script type="text/javascript" language="javascript" src="@Url.Content("~/kindeditor/kindeditor-min.js")"></script>

    <script type="text/javascript" language="javascript" src="@Url.Content("~/kindeditor/lang/zh_CN.js")"></script>

<script type="text/javascript">

        var editor1;
        KindEditor.ready(function (K) {
            editor1 = K.create('#txtIntroduction', {
                cssPath: 'http://www.cnblogs.com/kindeditor/plugins/code/prettify.css',
                uploadJson: 'http://www.cnblogs.com/kindeditor/asp.net/upload_json.ashx',
                fileManagerJson: 'http://www.cnblogs.com/kindeditor/asp.net/file_Manager_json.ashx',
                allowFileManager: true,
                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();
                    });
                }
            });
        });
    </script>

 

 <textarea id="txtIntroduction" name="txtIntroduction" style="width: 670px; height: 400px;"></textarea>

enctype = "multipart/form-data"

 

3. 为什么会丢失某些HTML标签,是不是编辑器的BUG?这是因为3.4版本以前编辑器默认开启了过滤模式(filterMode:true)。当filterMode为true时,编辑器会根据htmlTags设定自动过滤HTML代码,主要是为了生成干净的代码。

如果想保留所有HTML,请将filterMode设置成false。如果想保留特定HTML,请将filterMode设置成true后,配置htmlTags属性。
从3.4版本开始默认关闭过滤模式,所以要过滤HTML,需要将filterMode设置成true。

KE.show({
        id :'textarea_id',         filterMode :true// true:开启过滤模式, false:关闭过滤模式 });

 

//使用正则表达式判断评论内容是否包含敏感词           List
list = db.Articel_Words.Select(a=>a.WordPattern).ToList();//敏感词集合 string regexStr = string.Join("|", list);//格式:aa|bb|cc string commentMsg = "轮功"; if (Regex.IsMatch(commentMsg,regexStr)) { ViewBag.Msg = "包含敏感词"; }

转载于:https://www.cnblogs.com/yxlblogs/archive/2013/04/25/3041560.html

你可能感兴趣的文章
python正则表达式入门一
查看>>
python正则表达式入门二
查看>>
scrapy运行
查看>>
XPATH入门
查看>>
python爬虫 CSS选择器
查看>>
正常关闭java程序
查看>>
查看linux核心数
查看>>
数据结构与算法三: 数组
查看>>
Activiti工作流会签二 启动流程
查看>>
Activiti工作流会签三 撤销,审批,驳回
查看>>
Oauth2方式实现单点登录
查看>>
CountDownLatch源码解析加流程图详解--AQS类注释翻译
查看>>
ES相关度评分
查看>>
我们一起做一个可以商用的springboot脚手架
查看>>
idea在搭建ssm框架时mybatis整合问题 无法找到mapper
查看>>
java设计基本原则----单一职责原则
查看>>
HashMap的实现
查看>>
互斥锁 synchronized分析
查看>>
java等待-通知机制 synchronized和waity()的使用实践
查看>>
win10 Docke安装mysql8.0
查看>>