import './styles.scss' import CharacterCount from '@tiptap/extension-character-count' import Document from '@tiptap/extension-document' import Mention from '@tiptap/extension-mention' import Paragraph from '@tiptap/extension-paragraph' import Text from '@tiptap/extension-text' import { EditorContent, useEditor } from '@tiptap/react' import React from 'react' import suggestion from './suggestion' 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.storage.characterCount.characters()) : 0 return (