码迷,mamicode.com
首页 > Web开发 > 详细

Ueditor 的使用(这里以php+ci为例)

时间:2018-01-16 18:42:38      阅读:529      评论:0      收藏:0      [点我收藏+]

标签:path   set   html   文件名   text   public   pre   ansi   cti   

下载:自行百度。

页面代码:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
    <script type="text/javascript" charset="utf-8" src="public/js/ueditor/ueditor.config.js"></script>
    <script type="text/javascript" charset="utf-8" src="public/js/ueditor/ueditor.all.min.js"> </script>
    <!--建议手动加在语言,避免在ie下有时因为加载语言失败导致编辑器加载失败-->
    <!--这里加载的语言文件会覆盖你在配置项目里添加的语言类型,比如你在配置项目里配置的是英文,这里加载的中文,那最后就是中文-->
    <script type="text/javascript" charset="utf-8" src="public/js/ueditor/lang/zh-cn/zh-cn.js"></script>
    
    <style type="text/css">
        div{ width:100%; }
    </style>
</head>
<body>
<div>
    <script id="editor" type="text/plain" style="width:500px;height:100px;"></script>
</div>

    <script type="text/javascript">

        //实例化编辑器
        //建议使用工厂方法getEditor创建和引用编辑器实例,如果在某个闭包下引用该编辑器,直接调用UE.getEditor(‘editor‘)就能拿到相关的实例
        var ue = UE.getEditor(‘editor‘,{
            //配置工具栏菜单(这里距离个别)
            toolbars:[
                [‘fontsize‘,‘bold‘,‘italic‘,‘underline‘,‘insertcode‘,‘horizontal‘,‘simpleupload‘]
            ],
            //是否显示路径
            elementPathEnabled:false,
            //是否显示字数统计
            wordCount:false,
            //是否自动本地草稿保存
            autosave:false,
        });
        ue.ready(function(){
            //编辑器输入框内的默认文字
            ue.setContent(‘写回答...‘);
        });
        
    </script>
</body>
</html>

配置文件修改:
这里我把ueditor插件放在了:public/js/ueditor 目录里;
配置文件路径:public/js/ueditor/php/config.json

修改上传路径:

/* 上传保存路径,可以自定义保存路径和文件名格式 */
"imagePathFormat": "/public/ueditor/php/upload/image/{yyyy}{mm}{dd}/{time}{rand:99}", 

/* 涂鸦图片*/
"scrawlPathFormat": "/public/ueditor/php/upload/image/{yyyy}{mm}{dd}/{time}{rand:6}", 

/*截图工具*/
"snapscreenPathFormat": "/public/ueditor/php/upload/image/{yyyy}{mm}{dd}/{time}{rand:6}",

/*远程抓取*/
"catcherPathFormat": "/public/ueditor/php/upload/image/{yyyy}{mm}{dd}/{time}{rand:6}",

/* 上传保存路径,可以自定义保存路径和文件名格式 */
"videoPathFormat": "/public/ueditor/php/upload/video/{yyyy}{mm}{dd}/{time}{rand:6}", 

/* 上传保存路径,可以自定义保存路径和文件名格式 */
"filePathFormat": "/public/ueditor/php/upload/file/{yyyy}{mm}{dd}/{time}{rand:6}", 

先写到这里,,,待续...

Ueditor 的使用(这里以php+ci为例)

标签:path   set   html   文件名   text   public   pre   ansi   cti   

原文地址:https://www.cnblogs.com/richardcastle/p/8297024.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!