Skip to content

How do I render a preview of an editor's value outside of the editor? #2649

Closed Answered by zbeyens
kieranm asked this question in Q&A
Discussion options

You must be logged in to vote

You can make use of the readOnly prop provided by Plate. By setting this prop to true, you can ensure that the content is rendered in a read-only mode.
Inside Plate, the elements can use the useEditorReadOnly hook to adjust the rendering based on the readOnly prop. This allows you to display the content exactly as it appears in the editor minus editable elements.

Alternatively, if you prefer not to use Plate for rendering, you can manually render the elements from value. You can refer to https://github.com/rockettomatooo/slate-react-presentation for guidance on how to achieve this approach.

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@kieranm
Comment options

Answer selected by zbeyens
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants