linXiv frontend (TS/JS)
    Preparing search index...

    Interface EditorBridgeHandlers

    Pluggable host behavior. All are optional — the client has sensible defaults.

    interface EditorBridgeHandlers {
        fs?: FsResponder;
        getInitialDoc?: () => DocOpenPayload | null | undefined;
        getThemeState?: () => ThemePushState;
        onCompiled?: (status: number, log: string, pdf: string | null) => void;
        onDirty?: (dirty: boolean) => void;
        onPickFolder?: () => Promise<string | null>;
        onReady?: (protocol?: number) => void;
    }
    Index

    FS-adapter RPC handler. Defaults to NoopFsResponder.

    getInitialDoc?: () => DocOpenPayload | null | undefined

    The document/project to mount immediately after the handshake. Return null/undefined to skip the auto doc:open (the host can call sendDocOpen() later instead).

    getThemeState?: () => ThemePushState

    Resolve the current theme to push on the 'texbrain:ready' handshake (and any later manual pushTheme() call). Required to theme the editor before first paint.

    onCompiled?: (status: number, log: string, pdf: string | null) => void

    Compile finished (or failed) on the guest. pdf is base64-encoded.

    onDirty?: (dirty: boolean) => void

    Editor buffer dirty-state changed.

    onPickFolder?: () => Promise<string | null>

    The guest asked for the host's NATIVE directory picker (its embedded "Open Folder" — the iframe can't pick itself). Show the dialog, re-root the fs responder at the chosen folder, and resolve with the folder's basename (null = user cancelled). Unset ⇒ the client replies ok:false so the guest surfaces an error instead of hanging.

    onReady?: (protocol?: number) => void

    Guest completed its boot handshake. protocol is what the live Editor build reports in texbrain:ready — a runtime cross-check only (the compat gate is the install/update-time manifest check, ADR 0017). Compare against SUPPORTED_BRIDGE_PROTOCOLS (src/api/editorPlugin.ts) for a non-fatal warning.