File size: 988 Bytes
1e92f2d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
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
);
|