Skip to content

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

:bug: Clear block selection highlight when switching to read-only https://github.com/siyuan-note/siyuan/issues/19559

Daniel3d98624813ee
diff --git a/app/src/protyle/ui/hideElements.ts b/app/src/protyle/ui/hideElements.ts
index cb7fb2b390..c93b30579f 100644
--- a/app/src/protyle/ui/hideElements.ts
+++ b/app/src/protyle/ui/hideElements.ts
@@ -3,6 +3,7 @@ import {hideRectResizeHandles} from "../../asset/rectAnnotationResize";
import {isIPhone} from "../util/compatibility";
import {hideGutterElements} from "./gutterVisibility";
import {closeSubElement} from "../toolbar/subElementLifecycle";
+import {clearBlockSelectionMode} from "../wysiwyg/blockSelection";
// "gutter", "toolbar", "select", "hint", "util", "dialog", "gutterOnly"
export const hideElements = (panels: string[], protyle?: IProtyle, focusHide = false) => {
@@ -53,11 +54,7 @@ export const hideElements = (panels: string[], protyle?: IProtyle, focusHide = f
}
}
if (panels.includes("select")) {
- protyle.wysiwyg.element.querySelectorAll(".protyle-wysiwyg--select").forEach(item => {
- item.classList.remove("protyle-wysiwyg--select");
- item.removeAttribute("select-start");
- item.removeAttribute("select-end");
- });
+ clearBlockSelectionMode(protyle.wysiwyg.element, true);
}
};