ThinkPHP整合各大主流在线编辑器的方法 推荐
2013-07-08 17:44
393 查看
今天一个客户要求在编辑器里增加可以拖动图片的方法,研究了很久,发现这几种编辑器只有在ie下才可以拖动图片大小,包括网易用的编辑器,QQ空间的编辑器,先提前声明一下。下面进入重点
1.百度编辑器ueditor
先新建项目,生成以后在目录下新建一个plugins文件夹
然后下载ueditor,地址:http://ueditor.baidu.com/website/download.html,注意编码。下载以后解压将整合文件夹放到plugins里,并且改名为ueditor 将项目名/Lib/Action/IndexAction.clas.php添加
然后在对应的模版里添加,在<head></head>中间添加
在需要的地方添加
这是textera的方式,也可以用div,p都可以,官方推荐的是
看需要删除即可。最近百度网盘有个活动,如果有兴趣的朋友可以参加一下,还有个人收集的一些书籍http://pan.baidu.com/share/link?shareid=3950160737&uk=38268862922.kindeditor下载地址:http://www.kindsoft.net/down.php解压改名放到plugins下,在模版里添加
显示的样式,自然就是51cto博客编辑器的样子了。3.xheditor ,号称最干净整洁的在线编辑器下载地址:http://xheditor.com/download复制到plugins下改名
在需要的模版中添加
1.百度编辑器ueditor
先新建项目,生成以后在目录下新建一个plugins文件夹
然后下载ueditor,地址:http://ueditor.baidu.com/website/download.html,注意编码。下载以后解压将整合文件夹放到plugins里,并且改名为ueditor 将项目名/Lib/Action/IndexAction.clas.php添加
class IndexAction extends Action { function index(){ $this->display(); } }
然后在对应的模版里添加,在<head></head>中间添加
<script type="text/javascript" src="/edit/plugins/ueditor/ueditor.config.js"></script> <script type="text/javascript" src="/edit/plugins/ueditor/ueditor.all.js"></script>
在需要的地方添加
<textarea id="myEditor" name="content" style="width:700px;height:300px;"> </textarea> <script type="text/javascript"> UE.getEditor('myEditor') </script>
这是textera的方式,也可以用div,p都可以,官方推荐的是
<script type="text/plain" id="myEditor"> //从数据库中取出文章内容打印到此处 </script>
toolbars:[ ['fullscreen', 'source', '|', 'undo', 'redo', '|', 'bold', 'italic', 'underline', 'fontborder', 'strikethrough', 'superscript', 'subscript', 'removeformat', 'formatmatch', 'autotypeset', 'blockquote', 'pasteplain', '|', 'forecolor', 'backcolor', 'insertorderedlist', 'insertunorderedlist', 'selectall', 'cleardoc', '|', 'rowspacingtop', 'rowspacingbottom', 'lineheight', '|', 'customstyle', 'paragraph', 'fontfamily', 'fontsize', '|', 'directionalityltr', 'directionalityrtl', 'indent', '|', 'justifyleft', 'justifycenter', 'justifyright', 'justifyjustify', '|', 'touppercase', 'tolowercase', '|', 'link', 'unlink', 'anchor', '|', 'imagenone', 'imageleft', 'imageright', 'imagecenter', '|', 'insertimage', 'emotion', 'scrawl', 'insertvideo', 'music', 'attachment', 'map', 'gmap', 'insertframe','insertcode', 'webapp', 'pagebreak', 'template', 'background', '|', 'horizontal', 'date', 'time', 'spechars', 'snapscreen', 'wordimage', '|', 'inserttable', 'deletetable', 'insertparagraphbeforetable', 'insertrow', 'deleterow', 'insertcol', 'deletecol', 'mergecells', 'mergeright', 'mergedown', 'splittocells', 'splittorows', 'splittocols', '|', 'print', 'preview', 'searchreplace', 'help'] ]
看需要删除即可。最近百度网盘有个活动,如果有兴趣的朋友可以参加一下,还有个人收集的一些书籍http://pan.baidu.com/share/link?shareid=3950160737&uk=38268862922.kindeditor下载地址:http://www.kindsoft.net/down.php解压改名放到plugins下,在模版里添加
<script charset="utf-8" src="/edit/plugins/kindeditor/kindeditor.js"></script> <script charset="utf-8" src="/edit/plugins/kindeditor/lang/ko.js"></script> <script> KindEditor.ready(function(K) { window.editor = K.create('#editor_id'); });
<textarea id="myEditor" name="content" style="width:700px;height:300px;"> </textarea>
显示的样式,自然就是51cto博客编辑器的样子了。3.xheditor ,号称最干净整洁的在线编辑器下载地址:http://xheditor.com/download复制到plugins下改名
在需要的模版中添加
<script type="text/javascript" src="/edit/plugins/xheditor/jquery/jquery-1.4.4.min.js"></script> <script type="text/javascript" src="/edit/plugins/xheditor/xheditor-1.1.14-zh-cn.js"></script>
<textarea name="content" class="xheditor"></textarea>即可,剩下的就是和后端的处理了。 一般我就比较喜欢使用这三种编辑器,而且各有特点,现在不喜欢fckeditor了,外观不美观,而且上传之类的,容易出问题,包括有上传漏洞。就不说了。有兴趣的朋友可以加群:252799167一起学习进步
相关文章推荐
- thinkphp整合ueditor(百度编辑器)方法详解
- 推荐7款国产的在线HTML编辑器
- 推荐一款功能强大的js 在线编辑器
- 推荐7款国产的在线HTML编辑器
- Kindeditor编辑器 jsp上传错误解决方法 与struts2冲突整合
- 基于thinkphp的在线编辑器kindeditor-v4.1.3
- Thinkphp3.2.3整合最新百度Ueditor1.4.3编辑器
- ThinkPHP整合Html编辑器时出现自动转义的问题
- JMEditor V0.9.4开源在线公式编辑器全面支持主流浏览器
- ASP.NET常用在线编辑器使用方法总结(二)
- Thinkphp 2.0 整合fck编辑器
- 推荐1款在线HTML编辑器(Ueditor)
- 在线HTML编辑器推荐
- 推荐两款基于JQuery的在线内容编辑器
- ASP.NET常用在线编辑器使用方法总结(二)
- eclipse中安装freemarker插件及ftl使用freemarker编辑器--在线安装方法
- Model:relation您所请求的方法不存在! thinkphp 最佳答案 推荐
- 几种适合开发用的在线编辑器-推荐及下载
- 带领大家一起做一个ThinkPHP整合jcrop图片上传裁切预览的例子 推荐
- ThinkPHP5整合LayUI编辑器图片上传