From dc8ced773c36272f39707f70ab7f29db9e71d4aa Mon Sep 17 00:00:00 2001 From: Vanessa Date: Sat, 27 Jan 2024 20:16:54 +0800 Subject: [PATCH] =?UTF-8?q?:art:=20=E5=A4=9A=E9=80=89=E5=8D=95=E5=85=83?= =?UTF-8?q?=E6=A0=BC=E8=87=AA=E5=8A=A8=E6=BB=9A=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/protyle/wysiwyg/index.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.ts index fb020a026..7a40cdf46 100644 --- a/app/src/protyle/wysiwyg/index.ts +++ b/app/src/protyle/wysiwyg/index.ts @@ -532,8 +532,23 @@ export class WYSIWYG { const originIndex = getPositionByCellElement(avCellElement); let moveCellElement: HTMLElement; let lastCellElement: HTMLElement; + const nodeRect = nodeElement.getBoundingClientRect(); + const scrollElement = nodeElement.querySelector(".av__scroll"); + const contentRect = protyle.contentElement.getBoundingClientRect(); documentSelf.onmousemove = (moveEvent: MouseEvent) => { const tempCellElement = hasClosestByClassName(moveEvent.target as HTMLElement, "av__cell") as HTMLElement; + if (scrollElement.scrollWidth > scrollElement.clientWidth + 2) { + if (moveEvent.clientX > nodeRect.right - 10) { + scrollElement.scrollLeft += 10; + } else if (moveEvent.clientX < nodeRect.left + 34) { + scrollElement.scrollLeft -= 10; + } + if (moveEvent.clientY < contentRect.top + 48) { + protyle.contentElement.scrollTop -= 5; + } else if (moveEvent.clientY > contentRect.bottom - 48) { + protyle.contentElement.scrollTop += 5; + } + } if (moveCellElement && tempCellElement && tempCellElement.isSameNode(moveCellElement)) { return; }