tiptap/packages/react/src/useReactNodeView.ts

12 lines
331 B
TypeScript
Raw Normal View History

2021-03-15 16:00:44 +08:00
import { createContext, useContext } from 'react'
2021-03-15 03:40:40 +08:00
2021-03-15 05:41:25 +08:00
export interface ReactNodeViewContextProps {
onDragStart: (event: DragEvent) => void,
}
2021-03-15 16:00:44 +08:00
export const ReactNodeViewContext = createContext<Partial<ReactNodeViewContextProps>>({
2021-03-15 03:40:40 +08:00
onDragStart: undefined,
})
export const useReactNodeView = () => useContext(ReactNodeViewContext)