ueditor富文本编辑器使用图片问题

此编辑器的图片使用最近遇上两个问题

一、图片上传后选中图片,下滑滚动条后再次点击图片,图片错位

找到fiximgclick.js文件的attachTo函数  修改domUtils.setStyles里面的top值

//修改前
'top': iframePos.y + imgPos.y - me.editor.document.body.scrollTop - editorPos.y - parseInt(resizer.style.borderTopWidth) + 'px'
                 
//修改后
'top': iframePos.y + imgPos.y - me.editor.document.documentElement.scrollTop - editorPos.y - parseInt(resizer.style.borderTopWidth) + 'px'

此解决方法参考原文:http://t.zoukankan.com/douyage-p-10948748.html 

二、图片选中后无法脱离选中状态,需要多次点击才能使光标出现

还是找到fiximgclick.js文件中,对hide传入参数true,在接收时做判断

 Scale.prototype = {
            init: function (editor) {
                var me = this;
                me.editor = editor;
                me.startPos = this.prePos = { x: 0, y: 0 };
                me.dragId = -1;

                var hands = [],
                    cover = me.cover = document.createElement('div'),
                    resizer = me.resizer = document.createElement('div');

                cover.id = me.editor.ui.id + '_imagescale_cover';
                cover.style.cssText = 'position:absolute;display:none;z-index:' + (me.editor.options.zIndex) + ';filter:alpha(opacity=0); opacity:0;background:#CCC;';
                domUtils.on(cover, 'mousedown click', function () {
                    //传人参数 true
                    me.hide(true);
                });
hide: function (reset) {
                var me = this;
                me.hideCover();
                me.resizer.style.display = 'none';

                domUtils.un(me.resizer, 'mousedown', me.proxy(me._eventHandler, me));
                domUtils.un(me.doc, 'mouseup', me.proxy(me._eventHandler, me));
                me.editor.fireEvent('afterscalehide', me);
                //做判断
                reset && me.editor.setContent(me.editor.getContent())
            },

 

 参考作者的回复评论:

 但是这个办法只是让多次点击图片之外空白的地方减少,点击两次取消选中状态出现光标,没有彻底解决这个问题。

如果同志们有更好的解决办法,多多指教,携手前行。

 

评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值