// React context for cross-canvas focus state. // // The chip node views are mounted via TipTap's ReactNodeViewRenderer; they // can't reach into props on the editor instance, but they can use React // Context (it propagates through any React tree, including TipTap's). "use client"; import { createContext, useContext } from "react"; export interface ChipFocusValue { focusBlockId: string | null; setFocusBlockId: (id: string | null) => void; } export const ChipFocusContext = createContext({ focusBlockId: null, setFocusBlockId: () => {}, }); export function useChipFocus(): ChipFocusValue { return useContext(ChipFocusContext); }