An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:art: https://github.com/siyuan-note/siyuan/issues/15331
Vanessa4d25a62ead79
diff --git a/app/src/assets/scss/protyle/_protyle.scss b/app/src/assets/scss/protyle/_protyle.scssindex 67fb5f65c6..36632238b5 100644--- a/app/src/assets/scss/protyle/_protyle.scss+++ b/app/src/assets/scss/protyle/_protyle.scss@@ -198,6 +198,7 @@position: fixed;background-color: var(--b3-theme-primary-lightest);z-index: 3; // 需大于 database header and footer+ pointer-events: none; // 划选矩形不拦截鼠标事件,避免 elementFromPoint 命中自身// 划选未超过一个块时不显示矩形&[data-empty="true"] {diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.tsindex 7315f17b3e..b0de9b3d81 100644--- a/app/src/protyle/wysiwyg/index.ts+++ b/app/src/protyle/wysiwyg/index.ts@@ -1321,8 +1321,8 @@ export class WYSIWYG {}}}- // 落点是否在缝隙/padding(nodeElement 为落点下方的块),滚动后该相对关系不变,于 mousedown 时记录一次- const startBelowPoint = !!nodeElement && nodeElement.getBoundingClientRect().top > y;+ // 落点是否在块外(padding/缝隙),此时 nodeElement 为探测所得,向上划选的遍历终点应用落点 y 而非 nodeElement 边+ const startOutsideBlock = fromOutsideX !== undefined || target.classList.contains("protyle-wysiwyg");if (!nodeElement) {const breadElement = hasClosestByClassName(target, "protyle-breadcrumb__item");if (breadElement) {@@ -1490,10 +1490,10 @@ export class WYSIWYG {// 块选择判定用的右边界需落在内容区,避免矩形右边缘在 padding 内时选不中块const selectRight = Math.max(newLeft + newWidth, mostLeft);// 向上划选时以 nodeElement 的实时边作为遍历终点(兼容滚动 https://github.com/siyuan-note/siyuan/issues/14664);- // 落点在缝隙时 nodeElement 为下方块,需用其 top(不含自身)避免误选下方块+ // 落点在缝隙/padding 时 nodeElement 为探测所得的块,其边会超出落点 y 导致误选,故以落点 y 为终点const startBlockRect = nodeElement.getBoundingClientRect();const selectBottom = moveEvent.clientY <= selectStartY- ? (startBelowPoint ? startBlockRect.top : startBlockRect.bottom)+ ? (startOutsideBlock ? y : startBlockRect.bottom): (newTop + newHeight);// newLeft 落在 padding 内时 elementFromPoint 会命中 wysiwyg 容器,需钳制到内容区const detectX = Math.max(mostLeft, Math.min(newLeft, mostRight));@@ -1513,7 +1513,8 @@ export class WYSIWYG {while (probeY < selectBottom) {probeY += 8;const probeElement = document.elementFromPoint(detectX, probeY);- if (probeElement && !isContainer(probeElement)) {+ // 命中非容器元素或容器块(list/sb 等 hasClosestBlock 可识别)即采用+ if (probeElement && (!isContainer(probeElement) || hasClosestBlock(probeElement))) {firstElement = probeElement;break;}