@mocanvas/editor · function
declare function useGlobalMenuIsOpen(id: string, onChange?: (isOpen: boolean) => void): readonly [boolean, (next: boolean) => void]Register a menu as globally open, so the editor can stand down while it is.
The editor keeps the set of open menu ids on its instance state; a canvas
that knows a menu is open suppresses the interactions that would fight it.
Returns the current state and a setter, in the shape a controlled menu
component wants ([open, onOpenChange]).
onChange is called with the new value whenever the setter runs — the seam
for the work a menu does on open, such as settling an in-flight gesture.
The id is removed again when the component unmounts, so a menu that is
torn down while open cannot leave the editor suppressed forever.
mocanvas is built by Symbio. Free for non-commercial, non-profit and development use; commercial use needs an agreement. Not affiliated with or endorsed by tldraw.