From d033e9a7be69d238ef80d0172144b8200258e673 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Fri, 3 Feb 2023 17:32:46 +0800 Subject: [PATCH] =?UTF-8?q?:art:=20=E6=94=B9=E8=BF=9B=20=E5=88=92=E9=80=89?= 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, 8 insertions(+), 7 deletions(-) diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.ts index 8297b1c2a..83b0c5ab8 100644 --- a/app/src/protyle/wysiwyg/index.ts +++ b/app/src/protyle/wysiwyg/index.ts @@ -571,15 +571,16 @@ export class WYSIWYG { 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); } - if (!firstElement || firstElement.classList.contains("protyle-wysiwyg")) { + if (!firstElement) { return; } - if (moveEvent.clientY > y && !startFirstElement) { - startFirstElement = firstElement; - } - const firstBlockElement = hasClosestBlock(firstElement); - if (!firstBlockElement) { - return; + let firstBlockElement = hasClosestBlock(firstElement); + if (moveEvent.clientY > y) { + if (!startFirstElement) { + startFirstElement = firstElement; + } + } else if (!firstBlockElement) { + firstBlockElement = protyle.wysiwyg.element.firstElementChild as HTMLElement; } let selectElements: Element[] = []; let currentElement: Element | boolean = firstBlockElement;