Skip to content

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

:bug: fix https://github.com/siyuan-note/siyuan/issues/7068

Vanessa4e9a27b1b5b9
diff --git a/app/src/protyle/toolbar/index.ts b/app/src/protyle/toolbar/index.ts
index 3a66ae1e01..e945edb4b5 100644
--- a/app/src/protyle/toolbar/index.ts
+++ b/app/src/protyle/toolbar/index.ts
@@ -255,6 +255,14 @@ export class Toolbar {
if (!nodeElement) {
return;
}
+ const endElement = hasClosestBlock(this.range.endContainer);
+ if (!endElement) {
+ return;
+ }
+ // 三击后还没有重新纠正 range 时使用快捷键标记会导致异常 https://github.com/siyuan-note/siyuan/issues/7068
+ if (!nodeElement.isSameNode(endElement)) {
+ this.range = setLastNodeRange(getContenteditableElement(nodeElement), this.range, false);
+ }
const rangeTypes = this.getCurrentType(this.range);
const selectText = this.range.toString();
fixTableRange(this.range);