MCPcopy Create free account
hub / github.com/editablejs/editable / useContextMenuEffect

Function useContextMenuEffect

packages/plugins/context-menu/src/store.ts:71–80  ·  view source on GitHub ↗
(aciton: ContextMenuStoreAction, editor: Editable)

Source from the content-addressed store, hash-verified

69type ContextMenuStoreAction = () => (() => void) | void
70
71export const useContextMenuEffect = (aciton: ContextMenuStoreAction, editor: Editable) => {
72 const [open] = useContextMenuOpen(editor)
73 useIsomorphicLayoutEffect(() => {
74 let destroy: (() => void) | void = undefined;
75 if (open) {
76 destroy = aciton()
77 }
78 return destroy
79 }, [open, editor, aciton])
80}
81
82export const ContextMenu = {
83 setOpen(editor: Editable, open: boolean) {

Callers 1

PlaygroundFunction · 0.90

Calls 1

useContextMenuOpenFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…