import React from 'react' import { useEditor, EditorContent } from '@tiptap/react' import Document from '@tiptap/extension-document' import Paragraph from '@tiptap/extension-paragraph' import Text from '@tiptap/extension-text' import CharacterCount from '@tiptap/extension-character-count' import Mention from '@tiptap/extension-mention' import suggestion from './suggestion' import './styles.scss' export default () => { const limit = 280 const editor = useEditor({ extensions: [ Document, Paragraph, Text, CharacterCount.configure({ limit, }), Mention.configure({ HTMLAttributes: { class: 'mention', }, suggestion, }), ], content: `
What do you all think about the new movie?
`, }) const percentage = editor ? Math.round((100 / limit) * editor.getCharacterCount()) : 0 return (