From c11b129341711937450bca36d88857b3a4d9aa45 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Mon, 27 Oct 2025 17:35:20 +0800 Subject: [PATCH] =?UTF-8?q?:art:=20https://github.com/siyuan-note/siyuan/i?= =?UTF-8?q?ssues/16179=20=E5=85=88=E7=A7=BB=E9=99=A4=EF=BC=8C=E5=90=A6?= =?UTF-8?q?=E5=88=99=E8=A1=A8=E6=A0=BC=E7=AC=AC=E4=B8=80=E6=AC=A1=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E9=80=89=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/layout/util.ts | 7 ------- app/src/protyle/wysiwyg/index.ts | 7 ++++--- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/app/src/layout/util.ts b/app/src/layout/util.ts index bb2e169c1..ed33c417f 100644 --- a/app/src/layout/util.ts +++ b/app/src/layout/util.ts @@ -65,13 +65,6 @@ export const setPanelFocus = (element: Element, isSaveLayout = true) => { return true; } }); - const blockElement = hasClosestBlock(document.activeElement); - if (blockElement) { - const editElement = getContenteditableElement(blockElement) as HTMLElement; - if (editElement) { - editElement.blur(); - } - } } }; diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.ts index 5cdffa424..55f40ae3d 100644 --- a/app/src/protyle/wysiwyg/index.ts +++ b/app/src/protyle/wysiwyg/index.ts @@ -3036,7 +3036,7 @@ export class WYSIWYG { let newRange = getEditorRange(this.element); // 点击两侧或间隙导致光标跳转到开头 https://github.com/siyuan-note/siyuan/issues/16179 if (hasClosestBlock(event.target) !== hasClosestBlock(newRange.startContainer) && - this.element.firstElementChild.contains(newRange.startContainer)) { + this.element.querySelector('[data-node-id]')?.contains(newRange.startContainer)) { const rect = this.element.getBoundingClientRect(); let rangeElement = document.elementFromPoint(rect.left + rect.width / 2, event.clientY); if (rangeElement === this.element) { @@ -3044,7 +3044,7 @@ export class WYSIWYG { } let blockElement = hasClosestBlock(rangeElement); if (blockElement) { - const embedElement = isInEmbedBlock(blockElement) + const embedElement = isInEmbedBlock(blockElement); if (embedElement) { blockElement = embedElement; } @@ -3078,7 +3078,8 @@ export class WYSIWYG { countSelectWord(newRange, protyle.block.rootID); } if (getSelection().rangeCount === 0 && !mobileBlur) { - // TODO https://github.com/siyuan-note/siyuan/issues/14589 点击 video 也可以测试一下 https://github.com/siyuan-note/siyuan/issues/14569 + // https://github.com/siyuan-note/siyuan/issues/14589 + // https://github.com/siyuan-note/siyuan/issues/14569 // https://github.com/siyuan-note/siyuan/issues/5901 focusByRange(newRange); }