Skip to content

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

:bug: Preserve backlink editor focus when toggling folds https://github.com/siyuan-note/siyuan/issues/19678

Danielc3e251578f32
diff --git a/app/src/protyle/gutter/index.ts b/app/src/protyle/gutter/index.ts
index 6ef3a89693..7373a9f5b3 100644
--- a/app/src/protyle/gutter/index.ts
+++ b/app/src/protyle/gutter/index.ts
@@ -381,6 +381,16 @@ export class Gutter {
});
});
this.element.addEventListener("dragend", restoreGutter);
+ this.element.addEventListener("mousedown", (event: MouseEvent) => {
+ if (event.button !== 0 || !protyle.options.backlinkData) {
+ return;
+ }
+ const buttonElement = hasClosestByTag(event.target as HTMLElement, "BUTTON");
+ if (buttonElement && buttonElement.getAttribute("data-type") === "fold") {
+ // 保持反链编辑区的焦点,避免引用块隐藏后布局变化导致折叠点击失效。
+ event.preventDefault();
+ }
+ });
this.element.addEventListener("click", (event: MouseEvent & { target: HTMLInputElement }) => {
const buttonElement = hasClosestByTag(event.target, "BUTTON");
if (!buttonElement) {