百度umeditor在线编辑器插入链接查看源码后变成http://undefined

转载自网址:
http://www.vephp.com/jiaocheng/125.html

问题:
百度umeditor在线编辑器,
插入超级链接,
查看源码后,
变成http://undefined

百度umeditor在线编辑器插入链接查看源码后变成http://undefined

百度umeditor在线编辑器插入链接查看源码后变成http://undefined

百度umeditor在线编辑器插入链接查看源码后变成http://undefined

百度umeditor在线编辑器插入链接查看源码后变成http://undefined

问题排查:

问题可以锁定在源码切换功能出现问题。

这个功能在umeditor.js第6907行左右

me.commands['source']

其中的 me.filterOutputRule(root); // 这里让超链接变成 http://undefined ,通过跟踪,我们把问题代码锁定在

a.setAttr('href', _href);

其中的 _href出问题了,它获取方式var _href = a.getAttr('_href');这个_href的属性不存在,因此获得取undefined值。如图:

因此,解决办法:

把var _href = a.getAttr('_href');改成var _href = a.getAttr('href');

同时加一个过滤保险:if(_href!='http://undefined') a.setAttr('href', _href);

如图:

百度umeditor在线编辑器插入链接查看源码后变成http://undefined

对于umeditor.min.js,查找 ftp|https?|\/|file 可以快速定位到问题代码处,并改动如下:

百度umeditor在线编辑器插入链接查看源码后变成http://undefined

搞定,刷新重新测试,问题解决了。

转载自网址:
http://www.vephp.com/jiaocheng/125.html

转载于:https://blog.51cto.com/phpervip/2133267

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值