欢迎您来到,李雷博客 | PHP博客        登录  |  注册

百度Ueditor纯文本粘贴规则及上传附件链接从新窗口打开等问题(用JQ解决)

更新:2020-06-23 09:11:04
人气:7114
来源:本站原创
A+

一、关于百度Ueditor编辑器,纯文本粘贴一些规则的记录:

,pasteplain:true  //是否默认为纯文本粘贴。false为不使用纯文本粘贴,true为使用纯文本粘贴
        //纯文本粘贴模式下的过滤规则
        ,'filterTxtRules' : function(){
            function transP(node){
                node.tagName = 'p';
                node.setStyle();
            }
            return {
                //直接删除及其字节点内容
                '-' : 'script style object iframe embed input select',
                'p': {$:{}},
                'br':{$:{}},
                'div':{'$':{}},
                'li':{'$':{}},
                'caption':transP,
                'th':transP,
                'tr':transP,
                'h1':'','h2':'','h3':'','h4':'','h5':'','h6':'','h7':'', //transP 转为P保留格式,''为清除格式,
                'td':function(node){
                    //没有内容的td直接删掉
                    var txt = !!node.innerText();
                    if(txt){
                        node.parentNode.insertAfter(UE.uNode.createText('    '),node);
                    }
                    node.parentNode.removeChild(node,node.innerText())
                }
            }
        }()

二、解决Ueditor上传的附件在指定DIV下的链接从新窗口打开:

<div class="hrefopen"><?=$hf_message?></div>

<script type="text/javascript"> 
	$(document).ready(function() { $('.hrefopen a').attr({target: "_blank"}); }); //指定新窗口打开链接
</script>

三、Ueditor的监听事件(失去焦点、内容改变)

<script type="text/javascript">
    var ue1 = UE.getEditor('editor1');
	
	UE.getEditor('editor1').addListener('blur',function(editor){//事件类型有blur,focus,contentChange(内容改变)
            abc();
	});
</script>

修改完配置,要清空缓存和cookie。

推荐的文章
# 发表我的评论
  /     /  
# 最近评论
暂时还没有评论,要不要说点什么?
  Ads by Google
  联系博主
Hello,本博客系统采用PHP和MySql开发,程序开发完全是因为个人爱好,是自己纯手写PHP源代码,未采用任何PHP框架!
QQ:858353007   微信号:lileihot123
网站地图
会员服务
关于我们
QQ:858353007
 
广告服务
加我微信
移动端访问
 
 
Copyright © 2014- 2024 www.mdaima.com All Rights Reserved.
李雷博客,专注PHP经验、PHP教程及PHP源代码开源下载分享的PHP博客!   ICP备案号:京ICP备10202169号-4