From 92a1af3b7f0fcdfb2d867ec21eb85020199bbd83 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Mon, 10 Oct 2022 11:15:00 +0800 Subject: [PATCH] :bug: fix https://github.com/siyuan-note/siyuan/issues/6132 --- app/src/protyle/util/selection.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/src/protyle/util/selection.ts b/app/src/protyle/util/selection.ts index 3901b3398..8a4745541 100644 --- a/app/src/protyle/util/selection.ts +++ b/app/src/protyle/util/selection.ts @@ -305,6 +305,10 @@ export const setFirstNodeRange = (editElement: Element, range: Range) => { } let firstChild = editElement.firstChild as HTMLElement; while (firstChild && firstChild.nodeType !== 3 && !firstChild.classList.contains("render-node")) { + if (firstChild.classList.contains("img")) { // https://ld246.com/article/1665360254842 + range.setStartBefore(firstChild); + return range; + } firstChild = firstChild.firstChild as HTMLElement; } if (!firstChild) {