Download react-page/docs/examples/slate-plugin-src/components/pluginHooks.ts from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 988 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-page/docs/examples/slate-plugin-src/components/pluginHooks.ts
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset@1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-page/docs/examples/slate-plugin-src/components/pluginHooks.ts
-
curl -L -o pluginHooks.ts https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-page/docs/examples/slate-plugin-src/components/pluginHooks.ts
988 Bytes
| import type { DependencyList } from 'react'; | |
| import { useMemo } from 'react'; | |
| import type { SlatePlugin } from '../types/SlatePlugin'; | |
| import type { SlateComponentPluginDefinition } from '../types/slatePluginDefinitions'; | |
| export const useComponentNodePlugins = ( | |
| { plugins }: { plugins: SlatePlugin[] }, | |
| deps: DependencyList | |
| ) => | |
| useMemo( | |
| () => | |
| plugins.filter( | |
| (plugin) => | |
| plugin.pluginType === 'component' && plugin.object !== 'mark' | |
| // eslint-disable-next-line @typescript-eslint/no-explicit-any | |
| ) as SlateComponentPluginDefinition<any>[], | |
| deps | |
| ); | |
| export const useComponentMarkPlugins = ( | |
| { plugins }: { plugins: SlatePlugin[] }, | |
| deps: DependencyList | |
| ) => | |
| useMemo( | |
| () => | |
| plugins.filter( | |
| (plugin) => | |
| plugin.pluginType === 'component' && plugin.object === 'mark' | |
| // eslint-disable-next-line @typescript-eslint/no-explicit-any | |
| ) as SlateComponentPluginDefinition<any>[], | |
| deps | |
| ); | |