From d79ca06c070b32858bab69fd3b5ddd510e708de7 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Wed, 19 Jun 2024 22:41:14 +0800 Subject: [PATCH] :art: https://github.com/siyuan-note/siyuan/issues/11763 --- app/src/protyle/wysiwyg/index.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.ts index a125daefe..e3d3311d0 100644 --- a/app/src/protyle/wysiwyg/index.ts +++ b/app/src/protyle/wysiwyg/index.ts @@ -724,10 +724,6 @@ export class WYSIWYG { return; } - // https://ld246.com/article/1681778773806 - if (["IMG", "VIDEO", "AUDIO"].includes(target.tagName)) { - return; - } // 多选节点 let x = event.clientX; if (event.clientX > mostRight) { @@ -744,6 +740,7 @@ export class WYSIWYG { this.element.querySelectorAll("iframe").forEach(item => { item.style.pointerEvents = "none"; }); + const contentRect = protyle.contentElement.getBoundingClientRect(); documentSelf.onmousemove = (moveEvent: MouseEvent) => { const moveTarget = moveEvent.target as HTMLElement; // table cell select @@ -806,6 +803,14 @@ export class WYSIWYG { } return; } + // 在包含 img, video, audio 的元素上划选后无法上下滚动 https://ld246.com/article/1681778773806 + // 在包含 img, video, audio 的元素上拖拽无法划选 https://github.com/siyuan-note/siyuan/issues/11763 + if (moveEvent.clientY < contentRect.top + Constants.SIZE_SCROLL_TB || moveEvent.clientY > contentRect.bottom - Constants.SIZE_SCROLL_TB) { + protyle.contentElement.scroll({ + top: protyle.contentElement.scrollTop + (moveEvent.clientY < contentRect.top + Constants.SIZE_SCROLL_TB ? -Constants.SIZE_SCROLL_STEP : Constants.SIZE_SCROLL_STEP), + behavior: "smooth" + }); + } protyle.selectElement.classList.remove("fn__none"); // 向左选择,遇到 gutter 就不会弹出 toolbar hideElements(["gutter"], protyle);