UNPKG

@selfcommunity/react-ui

Version:

React UI Components to integrate a Community created with SelfCommunity Platform.

15 lines (14 loc) 428 B
import { forwardRef, useImperativeHandle } from 'react'; import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'; const ApiPlugin = (props, ref) => { // HOOKS const [editor] = useLexicalComposerContext(); // EXPOSED METHODS useImperativeHandle(ref, () => ({ focus: () => { editor.focus(); } })); return null; }; export default forwardRef(ApiPlugin);