ianstormtaylor / slate

A completely customizable framework for building rich text editors. (Currently in beta.)
http://slatejs.org
MIT License
29.97k stars 3.25k forks source link

When I use stale read again, I have a problem ([Slate] value is invalid! Expected a list of elementsbut got: undefined) #5132

Open KawhiWei opened 2 years ago

KawhiWei commented 2 years ago

Description When I use stale read again, I have a problem ([Slate] value is invalid! Expected a list of elementsbut got: undefined) image

Recording If the Slate component and Editable are placed in the Form.Item tag of antdesign, this problem will occur. How can I solve it? The Slate version is 0.82.1, the slate read version is 0.83.0, and the ant design version is 4.10.2 image

boyaq commented 2 years ago

I have the same problem using slate with ant.design Form Item.

Adding an hidden input n Form.Item fixed my problem though.

    <Form.Item
      name="ug_description"
      label={i18n.t("common.mobile")}
      initialValue={data?.data?.ug_description}
    >
      <Slate editor={editor} value={initialValue}>
        <Editable />
      </Slate>
      <Input hidden />
    </Form.Item>
paulho1973 commented 1 year ago

https://stackblitz.com/edit/github-kgekdm

https://docs.slatejs.org/concepts/02-nodes

you need children property in editor value