Skip to content

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

:bug: Keep document block selection after repeated Select All https://github.com/siyuan-note/siyuan/issues/19161

Vanessa05c7c0d6bb46
diff --git a/app/src/protyle/util/selection.ts b/app/src/protyle/util/selection.ts
index 70b02a0dc0..6badaa4a03 100644
--- a/app/src/protyle/util/selection.ts
+++ b/app/src/protyle/util/selection.ts
@@ -63,6 +63,11 @@ export const fixTableRange = (range: Range) => {
};
export const selectAll = (protyle: IProtyle, nodeElement: Element, range: Range): boolean => {
+ const selectElements = protyle.wysiwyg.element.querySelectorAll(".protyle-wysiwyg--select");
+ if (selectElements.length > 0 && protyle.wysiwyg.element.childElementCount === selectElements.length &&
+ selectElements[0].parentElement === protyle.wysiwyg.element) {
+ return false;
+ }
const editElement = getContenteditableElement(nodeElement);
if (editElement) {
let position;
@@ -126,11 +131,6 @@ export const selectAll = (protyle: IProtyle, nodeElement: Element, range: Range)
}
}
range.collapse(true);
- const selectElements = protyle.wysiwyg.element.querySelectorAll(".protyle-wysiwyg--select");
- if (selectElements.length > 0 && protyle.wysiwyg.element.childElementCount === selectElements.length &&
- selectElements[0].parentElement === protyle.wysiwyg.element) {
- return false;
- }
hideElements(["select"], protyle);
const ids: string[] = [];
Array.from(protyle.wysiwyg.element.children).forEach(item => {