@viveeditor/react
v1.1.0
Published
React component for viveEditor with value/onChange, toolbar and every feature included.
Maintainers
Readme
@viveeditor/react
React component for viveEditor with value/onChange, toolbar and every feature included.
Part of viveEditor, a free, open-source rich text editor.
Install
npm install @viveeditor/react viveeditorUsage
import { ViveEditor } from '@viveeditor/react'
import 'viveeditor/style.css'
export function ArticleForm() {
const [html, setHtml] = useState('')
return <ViveEditor value={html} onChange={setHtml} locale="tr" label="Article body" />
}React 18 and 19. The component is marked 'use client'; useViveEditor gives you the editor instance for your own markup.
Only the features you use
@viveeditor/react/core has the same ViveEditor and useViveEditor, but loads only the extensions you pass. extensions is required, there is no locale, and the toolbar comes from a ui function (none when it is left out):
import '@viveeditor/core/style.css'
import '@viveeditor/ui/style.css'
import { basicExtensions } from '@viveeditor/ext-basic'
import { listExtensions } from '@viveeditor/ext-list'
import { createUI } from '@viveeditor/ui'
import { ViveEditor } from '@viveeditor/react/core'
const extensions = [...basicExtensions, ...listExtensions]
export function ArticleForm() {
const [doc, setDoc] = useState(null)
return (
<ViveEditor
extensions={extensions}
ui={(editor) => createUI(editor, { locale: 'tr' })}
format="json"
value={doc}
onChange={setDoc}
/>
)
}Install @viveeditor/core, @viveeditor/ui and the @viveeditor/ext-* packages you use next to @viveeditor/react.
License
MIT
