Skip to content
Discussion options

You must be logged in to vote

I solved the problem!

It's because initialValue of Plate component is [{ children: [{ text: '' }]}] by default.

I just changed my initialValue to [{ type: 'p', children: [{ text: '' }] }] then it works somehow.

here is my code

export const RichTextEditorV2: React.FC<RichTextEditorV2Props> = () => {
  const editableProps = {
    placeholder: 'placeholder',
    style: {
       // styles
    },
  }
  const [debugValue, setDebugValue] = useState<TNode<AnyObject>[] | null>(null)

  return (
    <Plate
      editableProps={editableProps}
      initialValue={[{ type: 'p', children: [{ text: '' }] }]}
      onChange={(newValue) => {
        setDebugValue(newValue)
        // save newValue...
      }

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@dylans
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
bug Something isn't working help wanted Extra attention is needed plugin:list-classic Bulleted & ordered lists
4 participants
Converted from issue

This discussion was converted from issue #1289 on December 09, 2021 18:08.