美文网首页
UEditor百度富文本编辑器,解决图片点击错位的问题

UEditor百度富文本编辑器,解决图片点击错位的问题

作者: 泪滴在琴上 | 来源:发表于2022-09-06 12:02 被阅读0次

因项目中采用的是百度的富文本编辑器UEditor,然后图片尺寸较大,点击图片想要修改尺寸,就出现了错位的问题,这里记录一下。


image.png

以明显的看出这个提示的框出现了错位的问题,然后怎么解决呢?
1.打开项目,找到UEditor官网下载的文件: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'
                });
            }

相关文章

网友评论

      本文标题:UEditor百度富文本编辑器,解决图片点击错位的问题

      本文链接:https://www.haomeiwen.com/subject/ynyinrtx.html