From 4feb8a67c1cc5ccf43fe7b3cda4811f5c2d43665 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Sat, 15 Jun 2024 22:42:04 +0800 Subject: [PATCH] :art: fix https://github.com/siyuan-note/siyuan/issues/11729 --- app/src/protyle/header/Title.ts | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/app/src/protyle/header/Title.ts b/app/src/protyle/header/Title.ts index 0279d02d2..36f0e899e 100644 --- a/app/src/protyle/header/Title.ts +++ b/app/src/protyle/header/Title.ts @@ -103,13 +103,17 @@ export class Title { return; } if (event.key === "ArrowDown") { - const noContainerElement = getNoContainerElement(protyle.wysiwyg.element.firstElementChild); - // https://github.com/siyuan-note/siyuan/issues/4923 - if (noContainerElement) { - focusBlock(noContainerElement, protyle.wysiwyg.element); + const rects = getSelection().getRangeAt(0).getClientRects() + // https://github.com/siyuan-note/siyuan/issues/11729 + if (this.editElement.getBoundingClientRect().bottom - rects[rects.length - 1].bottom < 25) { + const noContainerElement = getNoContainerElement(protyle.wysiwyg.element.firstElementChild); + // https://github.com/siyuan-note/siyuan/issues/4923 + if (noContainerElement) { + focusBlock(noContainerElement, protyle.wysiwyg.element); + } + event.preventDefault(); + event.stopPropagation(); } - event.preventDefault(); - event.stopPropagation(); } else if (event.key === "Enter") { const newId = Lute.NewNodeID(); const newElement = genEmptyElement(false, true, newId);