2026-07-16 04:44:30
•
5
ueditor插入的图片自适应编辑框大小,点击图片错位问题
解决点击图片错位问题
我的百度ueditor版本是1.5
ueditor/_src/plugins/fiximgclick.js 里面搜索attachTo,找到top位置修改即可
点击较大尺寸图片回出现错位,导致图片下面内容无法编辑,如图:
修改ueditor.all.js代码
找见attachTo: function (targetObj) {}函数
在函数内如下修改:
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版本是1.5
ueditor/_src/plugins/fiximgclick.js 里面搜索attachTo,找到top位置修改即可