百度编辑器点击图片修改图片的框错位问题

因项目中采用的是百度的富文本编辑器UEditor,因为内容比较多出现滚动条就会出现这个问题

文章转载于:https://www.jianshu.com/p/eb4787007268

 解决方案

1.打开项目,找到文件:ueditor.all.js

attachTo: function (targetObj) {
                var me = this,
                    target = me.target = targetObj,
                    resizer = this.resizer,
                    imgPos = domUtils.getXY(target),
                    iframePos = domUtils.getXY(me.editor.iframe),
                    editorPos = domUtils.getXY(resizer.parentNode);

                domUtils.setStyles(resizer, {
                    'width': target.width + 'px',
                    'height': target.height + 'px',
                    'left': iframePos.x + imgPos.x - me.editor.document.body.scrollLeft - editorPos.x - parseInt(resizer.style.borderLeftWidth) + 'px',
                    //修改前
                    //'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'
                });
            }

 

posted @ 2022-09-27 17:26  铁锅炖大鹅·  阅读(155)  评论(0)    收藏  举报