import React, { useState, useMemo } from 'react' import { Transforms, createEditor, Node } from 'slate' import { Slate, Editable, withReact, useSlateStatic, ReactEditor, useFocused, useSelected, } from 'slate-react' const EmbedsExample = () => { const [value, setValue] = useState(initialValue) const editor = useMemo(() => withEmbeds(withReact(createEditor())), []) return ( setValue(value)}> } placeholder="Enter some text..." /> ) } const withEmbeds = editor => { const { isVoid } = editor editor.isVoid = element => (element.type === 'video' ? true : isVoid(element)) return editor } const Element = props => { const { attributes, children, element } = props switch (element.type) { case 'video': return default: return

{children}

} } const VideoElement = ({ attributes, children, element }) => { const editor = useSlateStatic() const { url } = element return (