From c4d0499db572cb41136da08680d79073d60ea516 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Sat, 29 Jul 2023 11:54:38 +0800 Subject: [PATCH] =?UTF-8?q?:art:=20fix=20https://github.com/siyuan-note/si?= =?UTF-8?q?yuan/issues/8845=20av=20=E8=B0=83=E6=95=B4=E5=B8=83=E5=B1=80?= =?UTF-8?q?=E5=90=8E=E8=BE=B9=E7=95=8C=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/protyle/wysiwyg/index.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.ts index d13a9cf39..4a201a05c 100644 --- a/app/src/protyle/wysiwyg/index.ts +++ b/app/src/protyle/wysiwyg/index.ts @@ -343,7 +343,7 @@ export class WYSIWYG { const rect = protyle.element.getBoundingClientRect(); const mostLeft = rect.left + parseInt(protyle.wysiwyg.element.style.paddingLeft) + 1; // 不能用 firstElement,否则 https://ld246.com/article/1668758661338 - const mostRight = mostLeft + (protyle.wysiwyg.element.clientWidth - parseInt(protyle.wysiwyg.element.style.paddingLeft) - parseInt(protyle.wysiwyg.element.style.paddingRight)) - 1; + const mostRight = mostLeft + (protyle.wysiwyg.element.clientWidth - parseInt(protyle.wysiwyg.element.style.paddingLeft) - parseInt(protyle.wysiwyg.element.style.paddingRight)) - 2; const mostBottom = rect.bottom; const y = event.clientY; @@ -650,17 +650,17 @@ export class WYSIWYG { hideElements(["select"], protyle); let firstElement; if (moveEvent.clientY > y) { - firstElement = startFirstElement || document.elementFromPoint(newLeft - 1, newTop); + firstElement = startFirstElement || document.elementFromPoint(newLeft, newTop); endLastElement = undefined; } else { - firstElement = document.elementFromPoint(newLeft - 1, newTop); + firstElement = document.elementFromPoint(newLeft, newTop); startFirstElement = undefined; } if (!firstElement) { return; } if (firstElement.classList.contains("protyle-wysiwyg") || firstElement.classList.contains("list") || firstElement.classList.contains("sb") || firstElement.classList.contains("bq")) { - firstElement = document.elementFromPoint(newLeft - 1, newTop + 16); + firstElement = document.elementFromPoint(newLeft, newTop + 16); } if (!firstElement) { return;