Skip to content

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

1.0 KB
Raw Blame
import type {BacklinkContent} from "../../layout/dock/BacklinkContent";

const panels = new Set<BacklinkContent>();
export const registerMobileBacklinkPanel = (panel: BacklinkContent) => {
    panels.add(panel);
    return () => {
        panels.delete(panel);
    };
};

export const getMobileBacklinkPanels = () => Array.from(panels);

export const removeMobileBacklinkContent = (options: {notebookId?: string, rootIDs?: string[]}) => {
    panels.forEach(panel => {
        if ((options.notebookId && panel.notebookId === options.notebookId) ||
            options.rootIDs?.includes(panel.rootId) || Array.from(panel.element.querySelectorAll("[data-notebook-id]"))
                .some(element => element.getAttribute("data-notebook-id") === options.notebookId) || panel.editors.some(editor =>
                (options.notebookId && editor.protyle.notebookId === options.notebookId) ||
                options.rootIDs?.includes(editor.protyle.block.rootID))) {
            panel.switchBlock("", "", "");
        }
    });
};