Skip to content

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

:bug: Select paragraphs containing inline math on triple-click https://github.com/siyuan-note/siyuan/issues/18749

Daniel305ab5c27e8d
diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.ts
index a2093e3cfe..1f836bf330 100644
--- a/app/src/protyle/wysiwyg/index.ts
+++ b/app/src/protyle/wysiwyg/index.ts
@@ -4769,6 +4769,16 @@ export class WYSIWYG {
newRange.collapse(false);
focusByRange(newRange);
}
+ const tripleClickBlockElement = event.detail > 2 && hasClosestBlock(event.target);
+ if (tripleClickBlockElement &&
+ ["NodeParagraph", "NodeHeading"].includes(tripleClickBlockElement.getAttribute("data-type")) &&
+ tripleClickBlockElement.querySelector('[data-type~="inline-math"]')) {
+ // 浏览器完成三击选区后,将行级公式截断的选区补齐到整个段落或标题
+ const editableElement = getContenteditableElement(tripleClickBlockElement);
+ setFirstNodeRange(editableElement, newRange);
+ setLastNodeRange(editableElement, newRange, false);
+ focusByRange(newRange);
+ }
/// #if !MOBILE
if (newRange.toString().replace(Constants.ZWSP, "") !== "") {
const paintedRange = formatPainter.paint(protyle, newRange);