import React, { ReactElement, useRef, useState } from 'react'; import { EditorState, ContentState } from 'draft-js'; import Editor from '@draft-js-plugins/editor'; import createLinkifyPlugin from '@draft-js-plugins/linkify'; import editorStyles from './editorStyles.css'; const linkifyPlugin = createLinkifyPlugin(); const plugins = [linkifyPlugin]; const SimpleMentionEditor = (): ReactElement => { const [editorState, setEditorState] = useState( EditorState.createWithContent( ContentState.createFromText('Hello there google.com') ) ); const editor = useRef(); const onChange = (value): void => { setEditorState(value); }; const focus = (): void => { editor.current.focus(); }; return (
{ editor.current = element; }} />
); }; export default SimpleMentionEditor;