Skip to content

Commit

Permalink
fix: readonly
Browse files Browse the repository at this point in the history
  • Loading branch information
EETagent committed Aug 31, 2024
1 parent 0c97c5b commit 1202815
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions lib/plate-readonly.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,21 @@
import './styles/globals.css'

import { Editor } from './components/plate-ui/editor'
import { Plate } from '@udecode/plate-common/react'
import { Plate, usePlateEditor } from '@udecode/plate-common/react'

import type { PlateEditorProps } from './plate'
import { createEditor } from './plugins'
import { plugins } from './plugins'

const PlateEditorReadonly = (props: PlateEditorProps) => {
const { value, className, children } = props

const editor = usePlateEditor({
value,
...plugins,
})

return (
<Plate {...props} editor={createEditor(value)} readOnly>
<Plate {...props} editor={editor} readOnly>
<Editor className={className} readOnly />
{children}
</Plate>
Expand Down

0 comments on commit 1202815

Please sign in to comment.