ueditor万能编辑器(百度) 使用

引入编辑器

放入项目中 -> Plugin (与home平级)javascript

定义配置变量 ->config.phpphp

//配置路径,方便第三方功能包访问 (自定义名称)
    'PLUGIN_URL'            => '/Plugin/'

引入js ->x.htmlhtml

<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.htmljava

<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.htmlweb

<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.jsonjson

"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 */
相关文章
相关标签/搜索