引入编辑器

来源:互联网 发布:流量龙卷风淘宝 编辑:程序博客网 时间:2024/05/17 09:17
摘要: 放入项目中 -> 定义配置变量 -> 引入js -> 引入编辑器 -> 增减功能
引入编辑器
放入项目中 -> Plugin (与home平级)
定义配置变量 ->config.php
//配置路径,方便第三方功能包访问 (自定义名称) 'PLUGIN_URL' => '/Plugin/'
引入js ->x.html
<script type="text/javascript" charset="utf-8" src="{$Think.config.PLUGIN_URL}ueditor.config.js"></script><script type="text/javascript" src="{$Think.config.PLUGIN_URL}ueditor.all.min.js"></script><script type="text/javascript" src="{$Think.config.PLUGIN_URL}/lang/zh-cn/zh-cn.js"></script>
 引入编辑器 -> x.html
<tr> <td>商品详细描述</td> <td> <textarea name="f_goods_introduce" id="goods_introduce" style="width: 730px;height: 320px;"></textarea> </td> </tr> <script type="text/javascript"> var ue = UE.getEditor('goods_introduce'); </script>
增减功能->x.html
<script type="text/javascript"> // 在new编辑器的实例时选择自己需要的从新定义 UEDITOR_CONFIG.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', '|', 'simpleupload', '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', 'charts', '|', 'print', 'preview', 'searchreplace', 'help', 'drafts' ]];</script>
 
数据接收配置
设置上传路径 -> Plugin/php/config.json
"imagePathFormat": "/ueditor/php/upload/image/{yyyy}{mm}{dd}/{time}{rand:6}",
     /* 上传保存路径,可以自定义保存路径和文件名格式 */
            /* {filename} 会替换成原文件名,配置这项需要注意中文乱码问题 */
            /* {rand:6} 会替换成随机数,后面的数字是随机数的位数 */
            /* {time} 会替换成时间戳 */
            /* {yyyy} 会替换成四位年份 */
            /* {yy} 会替换成两位年份 */
            /* {mm} 会替换成两位月份 */
            /* {dd} 会替换成两位日期 */
            /* {hh} 会替换成两位小时 */
            /* {ii} 会替换成两位分钟 */
            /* {ss} 会替换成两位秒 */
            /* 非法字符 \ : * ? " < > | */
            /* 具请体看线上文档: fex.baidu.com/ueditor/#use-format_upload_filename */
0 0