import { createContext, useContext } from 'react'; /** * The page surface plugin blocks run against (issue #76). Provided by the * page editor around its `EditorContent`, consumed by the `plugin_block` * node views — the same React-context route the wikilink node view uses, so * the TipTap extension needs no per-page configuration and the editor never * rebuilds when plugin data loads. */ export interface PluginBlockScope { pageId?: string; pondId?: string; /** Navigate to a page (backs the `ui.openPage` capability). */ openPage?: (pageId: string) => void; /** Show a message in the app's toast stack (`ui.toast`, #130). */ toast?: (message: string) => void; /** Scroll the content to a heading by outline id (`ui.scrollToHeading`, #77). */ scrollToHeading?: (headingId: string) => void; } export const PluginBlockContext = createContext({}); export function usePluginBlockScope(): PluginBlockScope { return useContext(PluginBlockContext); }