Skip to content

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

552 B
Raw Blame
export const isDirectMathClick = (math: HTMLElement, event: MouseEvent) => {
    if (math.tagName !== "SPAN" || !math.getAttribute("data-type")?.split(" ").includes("inline-math") ||
        event.detail === 0) {
        return true;
    }
    // 触摸目标可能被浏览器吸附到附近的公式,按实际坐标排除公式两侧和段末空白。
    return Array.from(math.getClientRects()).some(rect =>
        event.clientX >= rect.left && event.clientX < rect.right &&
        event.clientY >= rect.top && event.clientY < rect.bottom);
};