Skip to content

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

707 B
Raw Blame
export type TouchAxis = "x" | "y";

export const getTouchAxis = (xDiff: number, yDiff: number, threshold: number): TouchAxis | undefined => {
    if (Math.max(Math.abs(xDiff), Math.abs(yDiff)) < threshold) {
        return;
    }
    return Math.abs(xDiff) > Math.abs(yDiff) ? "x" : "y";
};

export const shouldStartLongPressMultiSelect = (
    tagName: string,
    dataType: string | undefined,
    insideInlineMath: boolean,
    imageMenuTarget: boolean,
    insideTableCell = false,
) => !(tagName === "SPAN" && (dataType || "").split(" ").some(type =>
    ["block-ref", "file-annotation-ref", "tag", "inline-memo", "a"].includes(type))) &&
    !insideInlineMath && !imageMenuTarget && !insideTableCell;