kindeditor在线编辑器的使用心得
转自 http://blog.csdn.net/chongxin1/article/details/53615354
1、 如何声明引用?
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>kindeditor在线编辑器的使用心得</title>
<!-- 添加kindeditor的引用 -->
<script type="text/javascript" charset="utf-8" src="js/kindeditor/kindeditor.js"></script>
<script type="text/javascript" charset="utf-8" src="js/kindeditor/lang/zh_CN.js"></script>
</head>
<script>
var editor;
KindEditor.ready(function(K){
editor = K.create('textarea[id="content"]',{
allowFileManager : true
});
});
</script>
<body>
<textarea id="content" style="width:100%;height: 500px;"></textarea>
</body>
</html>
2、设置简单编辑器模式
不知道为什么被官方屏蔽了,有需要的可以下载最后的《KindEditor例子》
3、如何获取kindeditor中的值?
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>03如何获取kindeditor中的值</title>
<!-- 添加kindeditor的引用 -->
<script type="text/javascript" charset="utf-8" src="js/kindeditor/kindeditor.js"></script>
<script type="text/javascript" charset="utf-8" src="js/kindeditor/lang/zh_CN.js"></script>
</head>
<script>
var editor;
KindEditor.ready(function(K){
editor = K.create('textarea[id="content"]',{
allowFileManager : true,
//设置编辑器为简单模式
items:[
'fontname','fontsize','i','forecolor','hilitecolor','bold','italic','underline',
'removeformat','i','justifyleft','justifycenter','justifyright','insertorderedlist',
'insertunorderedlist','i','emoticons','image','link'
],
//这行代码就是关键所在,当失去焦点时执行this.sync()
afterBlur : function() {
this.sync();//这个函数就是同步kindeditor的值到textarea文本框
}
});
});
//获取kindeditor中的值
function showKindeditor(){
//获取textarea中的值并在div中展示
document.getElementById("showKindeditor").innerHTML = document.getElementById("content").value;
}
</script>
<body>
<div style="width:38%;height: 500px;border: 1px solid black;float: left;display: inline-block;">
<div id="showKindeditor" style="width:100%;height: 70%;"></div>
<button onclick="showKindeditor()">显示kindeditor中的值</button>
</div>
<textarea id="content" style="width:60%;height: 500px;"></textarea>
</body>
</html>
4、如何设置kindeditor的值?
//不知道为什么被官方屏蔽了,有需要的可以下载最后的《KindEditor例子》
5、如何监听编辑器内容发生改变的事件
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>05如何监听编辑器内容发生改变的事件</title>
<!-- 添加kindeditor的引用 -->
<script type="text/javascript" charset="utf-8" src="js/kindeditor/kindeditor.js"></script>
<script type="text/javascript" charset="utf-8" src="js/kindeditor/lang/zh_CN.js"></script>
</head>
<script>
var index = 1;
var editor;
KindEditor.ready(function(K){
editor = K.create('textarea[id="content"]',{
allowFileManager : true,
afterChange : function(){
document.getElementById("showKindeditor").innerHTML += "编辑器内容发生改变"+(index++) + "<br/>";
}
});
});
</script>
<body>
<!--overflow:auto;溢出时自动显示滚动条-->
<div id="showKindeditor" style="overflow:auto;width:38%;height: 500px;border: 1px solid black;float: left;display: inline-block;">
<h3>用于打印日志</h3>
</div>
<textarea id="content" style="width:60%;height: 500px;"></textarea>
</body>
</html>
6、设置kindeditor为不可编辑状态
//不知道 为什么被官方屏蔽了,有需要的可以下载最后的《 KindEditor例子》
7、如何修改预览( preview )点击之后弹出框的大小?
找到preview.js文件,修改里面的宽度和高度即可。
8、kindeditor-4.1.10只读模式下可以全屏
kindeditor-4.1.10只读模式下不可以全屏,
对此KindEditor的作者Roddy给出的解决方案是,需要修改源码:
在kindeditor.js里搜索
self.toolbar.disableAll(isReadonly, []);
改为
self.toolbar.disableAll(isReadonly, ['fullscreen']);
然后就可以在只读模式下进行全屏展现了:
全屏之后又会变成可编辑模式,解决办法:
afterFocus : function(){//设置为不可编辑,只是内容
this.blur();
}
9、附上源码
kindeditor-4.0帮助文档.chm
kindeditor插件包.zip
KindEditor例子.zip
kindeditor在线编辑器的使用心得相关推荐
- KindEditor 在线编辑器
KindEditor 在线编辑器 http://www.kindsoft.net/demo.php
- 解决kindeditor在线编辑器 过滤dl、dd、dt的两种方法
<div id="operate"> <dl> <dt>数字遗产保险箱操作方式</dt> <dd>数字遗产保险箱是一个具 ...
- html4.0编辑器,KindEditor HTML(在线编辑器)
KindEditor是在国内比较受欢迎的HTML在线编辑器,本次更新新增单元格编辑功能,各种按钮(确定.取消.上传等按钮)在不同浏览器上保持相同外观. KindEditor v4.0.4 更新日志: ...
- kindeditor在线html编辑器,kindeditor在线HTML编辑器
kindeditor在线HTML编辑器 Think Defferent Here's to the crazy ones. The misfits. The rebels. The troublema ...
- 国产网页在线编辑器kindeditor的使用
作为以前在使用fckeditor,后来浏览器更新后发现fck编辑不好用(而且是致命的问题,根本不能编辑),而且界面也做的不怎样!后来发现国产中有一款开源的网页在线编辑器,试了一下感觉效果很不错!使用也 ...
- 在线编辑器 上传控件
为什么80%的码农都做不了架构师?>>> 在线编辑器 上传控件 http://kindeditor.net/demo.php 上传控件: 转载于:https://my.osch ...
- 基于ThinkPHP的在线编辑器调用
开源的在线编辑器有很多,比如FCKEditor,UEditor,Kindeditor等,调用方式也都大同小异 下面列举UEditor在线编辑器插件在ThinkPHP里面的应用 1.Ueditor下载地 ...
- jquery插件课程2 放大镜、多文件上传和在线编辑器插件如何使用
jquery插件课程2 放大镜.多文件上传和在线编辑器插件如何使用 一.总结 一句话总结:插件使用真的还是比较简单的,引包,初始化,配置参数(json),配置数据(json),而后两步不是必须的.而且 ...
- 好用在线html编辑器,求一款好用的html在线编辑器
icefruit 下面这几款html在线编辑器推荐给你使用.有详细的介绍你可以按照你的需要选择.RenderaRendera是一个在线的HTML5编辑器,它支持设计或源码浏览同步编辑.你可以在浏览器里 ...
最新文章
- 如何提高增加包含大量记录的表的主键字段的效率
- 如何利用 C# 实现 K 最邻近算法?
- 树形dp ---- 2018年杭电多校第二场 H travel
- 《Adobe Acrobat X中文版经典教程》—第1章复 习
- ios获取设备信息总结
- 单碟1.75T 西数14TB充氦硬盘今年上
- 会议中的Meeting App
- 神州云科DCN存储管理IP_干货!DCN校园网大二层解决方案详解
- Verilog HDL语言设计计数器+加法器
- 红橙Darren视频笔记 热更新 bsdiff bspatch 在Android设备上的应用 架构篇1完结篇
- Faied to run MSBuild commond CmakeError
- 深度学习笔记_卷积神经网络参数计算
- WEB测试环境搭建和测试方法大全
- python 爬虫——模拟登录古诗文网
- 无线通信里的 UAV
- 用MinIO对象存储构建企业数据集中备份系统
- 【文章整理】一文看懂Cola架构和DDD
- C#中包含英文月份的美式日期输出格式
- 计算机专业可以考天文学研究生吗,报考南京大学天文系有什么要求?
- 【2022年第一期 CANN训练营学习笔记】进阶班应用开发课 大作业1-开发DVPP应用,输入,输出都是JPEG图片,且分辨率不同
热门文章
- [每日100问][2011-9-30]iphone开发笔记,今天你肿了么
- 物联网无线传输模块 无线通信DTU
- kali ifconfig没有wlan0的解决方法
- 2020年总结与展望
- matlab 稳定系统,MATLAB分析在系统稳定性的应用
- MySQL实战——表、索引创建与优化
- java编程那些事儿 pdf,科学网—《java编程那些事儿》 前面部分阅读笔记 - 马舒天的博文...
- 计算机网络四交换技术,计算机网络数据交换技术发展
- Day1-介绍、基本语法、流程控制
- Web2.0视觉风格进化论