Skip to content

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

:bug: Exclude block attributes from cross-block text selections https://github.com/siyuan-note/siyuan/issues/18745

Daniel8fa4c18de5d8
diff --git a/app/src/assets/scss/protyle/_attr.scss b/app/src/assets/scss/protyle/_attr.scss
index b8d333f024..4643cd1bd0 100644
--- a/app/src/assets/scss/protyle/_attr.scss
+++ b/app/src/assets/scss/protyle/_attr.scss
@@ -8,7 +8,9 @@
font-weight: normal;
align-items: center;
line-height: 16px;
- // 容器保持可选以支持三击选中文本,仅排除属性内容 https://github.com/siyuan-note/siyuan/issues/16829
+ // 排除跨块划选中的属性占位 https://github.com/siyuan-note/siyuan/issues/18745
+ user-select: none;
+
& > div {
user-select: none;
}
@@ -69,3 +71,8 @@
display: none;
}
}
+
+// 三击时恢复属性容器可选,以保留浏览器的整段选择行为 https://github.com/siyuan-note/siyuan/issues/16829
+.protyle-wysiwyg--select-attr .protyle-attr {
+ user-select: auto;
+}
diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.ts
index 77ffc06c37..a2093e3cfe 100644
--- a/app/src/protyle/wysiwyg/index.ts
+++ b/app/src/protyle/wysiwyg/index.ts
@@ -1004,6 +1004,8 @@ export class WYSIWYG {
});
this.element.addEventListener("mousedown", (event: MouseEvent) => {
+ // 常规划选时排除属性占位,三击时恢复以保留浏览器的整段选择行为
+ this.element.classList.toggle("protyle-wysiwyg--select-attr", event.button === 0 && event.detail > 2);
if (protyle.toolbar.isMultiSelectMode()) {
event.preventDefault();
event.stopPropagation();