Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: fix https://github.com/siyuan-note/siyuan/issues/10357

Vanessab0602bc9407c
diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.ts
index 8a273ffb0a..17644add42 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);