({ id }: { id?: string })
| 22 | } |
| 23 | |
| 24 | export function EditorRefEffect({ id }: { id?: string }) { |
| 25 | const store = usePlateStore(id); |
| 26 | const editor = useAtomStoreValue(store, 'editor'); |
| 27 | const setIsMounted = useAtomStoreSet(store, 'isMounted'); |
| 28 | |
| 29 | React.useEffect(() => { |
| 30 | setIsMounted(true); |
| 31 | |
| 32 | return () => { |
| 33 | setIsMounted(false); |
| 34 | }; |
| 35 | }, [setIsMounted]); |
| 36 | |
| 37 | return ( |
| 38 | <> |
| 39 | {editor.meta.pluginCache.useHooks.map((key) => ( |
| 40 | <EditorRefPluginEffect |
| 41 | id={id} |
| 42 | key={key} |
| 43 | plugin={getPlugin(editor, { key })} |
| 44 | /> |
| 45 | ))} |
| 46 | </> |
| 47 | ); |
| 48 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…