MCPcopy
hub / github.com/udecode/plate / pluginRenderTextStatic

Function pluginRenderTextStatic

packages/core/src/static/pluginRenderTextStatic.tsx:15–47  ·  view source on GitHub ↗
(
  editor: SlateEditor,
  plugin: SlatePlugin
)

Source from the content-addressed store, hash-verified

13) => React.ReactElement<any> | undefined;
14
15export const pluginRenderTextStatic = (
16 editor: SlateEditor,
17 plugin: SlatePlugin
18): SlateRenderText =>
19 function render(nodeProps) {
20 const { children, text } = nodeProps;
21
22 if (text[plugin.node.type ?? plugin.key]) {
23 const Component = editor.meta.components?.[plugin.key] as any;
24 const Text = Component ?? SlateText;
25
26 // const dataAttributes = getPluginDataAttributes(editor, plugin, text);
27
28 const ctxProps = getRenderNodeStaticProps({
29 attributes: { ...(text.attributes as any) },
30 editor,
31 node: text,
32 path: nodeProps.path,
33 plugin,
34 props: nodeProps as any,
35 }) as any;
36
37 const defaultProps = Component ? {} : { as: plugin.render?.as };
38
39 return (
40 <Text {...defaultProps} {...ctxProps}>
41 {children}
42 </Text>
43 );
44 }
45
46 return children;
47 };
48
49/** @see {@link RenderText} */
50export const pipeRenderTextStatic = (

Callers 2

pipeRenderTextStaticFunction · 0.85

Calls 1

getRenderNodeStaticPropsFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…