import React, { useState } from 'react' import { Container } from '@toptal/picasso' import { SPACING_4, SPACING_8 } from '@toptal/picasso-utils' import { CodeBlockPlugin, CodePlugin, RichTextEditor, } from '@toptal/picasso-rich-text-editor' import { htmlToHast } from '@toptal/picasso-rich-text-editor/utils' import type { RichTextEditorChangeHandler } from '../types' // we expect defaultValue to be HAST from BE const defaultValue = htmlToHast( `

foo bar baz

qux quux quuz

<CodeBlock
{...props}
/>
` ) const Example = () => { const [value, setValue] = useState() const handleChange: RichTextEditorChangeHandler = newValue => setValue(newValue) return ( <> , ]} defaultValue={defaultValue} /> {value} ) } export default Example