fix: empty value
This commit is contained in:
parent
97c63830dd
commit
6b1ff526eb
@ -30,7 +30,7 @@ export const RichText = (props: any) => {
|
|||||||
const renderLeaf = useCallback((props) => <Leaf {...props} />, []);
|
const renderLeaf = useCallback((props) => <Leaf {...props} />, []);
|
||||||
const editor = useMemo(() => withHistory(withReact(createEditor() as ReactEditor)), []);
|
const editor = useMemo(() => withHistory(withReact(createEditor() as ReactEditor)), []);
|
||||||
const slateValue = useMemo(() => {
|
const slateValue = useMemo(() => {
|
||||||
editor.children = JSON.parse(JSON.stringify(value));
|
editor.children = JSON.parse(JSON.stringify(value || []));
|
||||||
Editor.normalize(editor, { force: true });
|
Editor.normalize(editor, { force: true });
|
||||||
return editor.children;
|
return editor.children;
|
||||||
}, [editor, value]);
|
}, [editor, value]);
|
||||||
|
Loading…
Reference in New Issue
Block a user