Skip to content

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

480 B
Raw Blame
interface IViewportBlock {
    id: string | null;
    top: number;
    bottom: number;
}

export const getVisibleRootBlockID = (blocks: IViewportBlock[], viewportTop: number, viewportBottom: number) => {
    return blocks.find((block) => block.id && block.bottom > viewportTop && block.top < viewportBottom)?.id;
};

export const isScrolledToBottom = (scrollTop: number, scrollHeight: number, clientHeight: number) => {
    return scrollHeight - scrollTop - clientHeight <= 1;
};