Download node_modules/@tiptap/react/src/useReactNodeView.ts from sitcod3/modul-s: direct link, hf CLI and curl.
- Browser
- Download file 994 Bytes
-
https://huggingface.co/spaces/sitcod3/modul-s/resolve/c06e4783a2be21cd7ca9fedf1ede4d4f0156ba3a/node_modules/%40tiptap/react/src/useReactNodeView.ts
- Command line
-
hf download hf://spaces/sitcod3/modul-s@c06e4783a2be21cd7ca9fedf1ede4d4f0156ba3a/node_modules/@tiptap/react/src/useReactNodeView.ts
-
curl -L -o useReactNodeView.ts https://huggingface.co/spaces/sitcod3/modul-s/resolve/c06e4783a2be21cd7ca9fedf1ede4d4f0156ba3a/node_modules/%40tiptap/react/src/useReactNodeView.ts
994 Bytes
| import type { ReactNode } from 'react' | |
| import { createContext, createElement, useContext } from 'react' | |
| export interface ReactNodeViewContextProps { | |
| onDragStart?: (event: DragEvent) => void | |
| nodeViewContentRef?: (element: HTMLElement | null) => void | |
| /** | |
| * This allows you to add children into the NodeViewContent component. | |
| * This is useful when statically rendering the content of a node view. | |
| */ | |
| nodeViewContentChildren?: ReactNode | |
| } | |
| export const ReactNodeViewContext = createContext<ReactNodeViewContextProps>({ | |
| onDragStart: () => { | |
| // no-op | |
| }, | |
| nodeViewContentChildren: undefined, | |
| nodeViewContentRef: () => { | |
| // no-op | |
| }, | |
| }) | |
| export const ReactNodeViewContentProvider = ({ | |
| children, | |
| content, | |
| }: { | |
| children: ReactNode | |
| content: ReactNode | |
| }) => { | |
| return createElement( | |
| ReactNodeViewContext.Provider, | |
| { value: { nodeViewContentChildren: content } }, | |
| children, | |
| ) | |
| } | |
| export const useReactNodeView = () => useContext(ReactNodeViewContext) | |