tiptap/packages/react/src/useReactNodeView.ts

14 lines
377 B
TypeScript
Raw Normal View History

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