百度编辑器

jsp引入
<!--  百度编辑器  -->
<script type="text/javascript" src="${ctx}/plugin/ueditor/ueditor.config.js"></script>
<script type="text/javascript" src="${ctx}/plugin/ueditor/ueditor.all.min.js"></script> 


js代码初始化:
$(function(){
    //实例化百度编辑器
    loadUE();
});  

function loadUE(){
    //实例化编辑器
    //建议使用工厂方法getEditor创建和引用编辑器实例,如果在某个闭包下引用该编辑器,
    //直接调用UE.getEditor('content')就能拿到相关的实例
    //var ue = UE.getEditor('content');//仓储服务
    UE.getEditor('content', {
        toolbars: [
             ['source''undo''redo''bold''italic''underline''fontborder',
              'backcolor''fontsize''fontfamily''justifyleft''justifyright',
              'justifycenter''justifyjustify','date''time''strikethrough',
              'superscript''subscript''removeformat''formatmatch''autotypeset',
              'blockquote''pasteplain''|''imagenone''imageleft''imageright''imagecenter''|',
              'insertimage''simpleupload','|',   
              'horizontal''date''time''spechars''snapscreen''wordimage''|'
              'forecolor''backcolor''insertorderedlist',
              'insertunorderedlist''selectall''cleardoc''link''unlink''emotion'
              'help','inserttable''deletetable']
        ],
        autoHeightEnabled:false,
        zIndex:2,
        maximumWords:10000,
        wordCount:true,
        wordCountMsg:"{#count}/10000" 
    });
    //复写UEDITOR的getActionUrl 方法,定义自己的Action
    UE.Editor.prototype._bkGetActionUrl = UE.Editor.prototype.getActionUrl;
    UE.Editor.prototype.getActionUrl = function(action) {
        if (action == 'uploadimage' || action == 'uploadfile') {
             return SysRootPath+'/mvc/file/upload.do';
        } else {
            return this._bkGetActionUrl.call(this, action);
        }
    };
    // 复写UEDITOR的getContentLength方法 解决富文本编辑器中一张图片或者一个文件只能算一个字符的问题,可跟数据库字符的长度配合使用
    UE.Editor.prototype._bkGetContentLength = UE.Editor.prototype.getContentLength;
    UE.Editor.prototype.getContentLength = function(){
        return this.getContent().length;
    };
} 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值