百度Ueditor纯文本粘贴规则及上传附件链接从新窗口打开等问题(用JQ解决)
更新:2020-06-23 09:11:04
人气:7299
来源:本站原创
A+
一、关于百度Ueditor编辑器,纯文本粘贴一些规则的记录:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | ,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下的链接从新窗口打开:
1 2 3 4 5 | < div class = "hrefopen" ><?=$hf_message?></ div > < script type = "text/javascript" > $(document).ready(function() { $('.hrefopen a').attr({target: "_blank"}); }); //指定新窗口打开链接 </ script > |
三、Ueditor的监听事件(失去焦点、内容改变)
1 2 3 4 5 6 7 | <script type= "text/javascript" > var ue1 = UE.getEditor( 'editor1' ); UE.getEditor( 'editor1' ).addListener( 'blur' , function (editor){ //事件类型有blur,focus,contentChange(内容改变) abc(); }); </script> |
修改完配置,要清空缓存和cookie。
推荐的文章
随手记
- ● 统信UOS系统如何设置指定时间自动重启系统的方法
- ● 自制(IP或域名)可信任的SSL证书,适用360、chrome等浏览器
- ● windows系统下php无法使用curl怎么办?
- ● 绿联UGREENKVM切换器(分屏器)快捷键丢失解决办法
- ● 统信UOS开机指定网址全屏启动自带浏览器以及屏蔽ALT+F4关闭
- ● xshellSSH连接Linux服务器防止超时退出
- ● php8开启OpenSSL扩展库报错disabledinstallext
- ● 统信系统linux安装php时的报错libxml-2.0>=2.7.6
- ● tidb关闭sql_mode=ONLY_FULL_GROUP_BY模式
- ● windows10如何开机自动运行bat文件
PHP经验分享
- ● PHP批量对TCP服务端指定多个IP非阻塞检查在线状态
- ● python实现TCP服务端持续接收关机、重启指令并输出结果【系列三】
- ● PHP给TCP服务端发送指令【系列二】
- ● PHP判断TCP服务端是否在线【系列一】
- ● PHP判断远程文件是否存在
- ● LINUX下用PHP获取CPU型号、内存占用、硬盘占用等信息代码
- ● PHP代码用UDP方式远程唤醒电脑让计算机开机
- ● apache下php生成验证码图片不能显示
- ● PHP使用AES加密解密示例(无偏移)
- ● Pluginmysql_native_passwordreported:''mysql_native_password'isdeprecate问题