From b0602bc9407ca220a30768b82806bd81b3a4fec7 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Fri, 16 Feb 2024 13:07:21 +0800 Subject: [PATCH] :art: fix https://github.com/siyuan-note/siyuan/issues/10357 --- app/src/protyle/wysiwyg/index.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.ts index 8a273ffb0..17644add4 100644 --- a/app/src/protyle/wysiwyg/index.ts +++ b/app/src/protyle/wysiwyg/index.ts @@ -2396,7 +2396,12 @@ export class WYSIWYG { setTimeout(() => { // 选中后,在选中的文字上点击需等待 range 更新 - const newRange = getEditorRange(this.element); + let newRange = getEditorRange(this.element); + // https://github.com/siyuan-note/siyuan/issues/10357 + const attrElement = hasClosestByClassName(newRange.endContainer, "protyle-attr") + if (attrElement) { + newRange = setLastNodeRange(attrElement.previousElementSibling, newRange, false); + } /// #if !MOBILE if (newRange.toString().replace(Constants.ZWSP, "") !== "") { protyle.toolbar.render(protyle, newRange);