diff --git a/site/examples/embeds.js b/site/examples/embeds.js index e8317fd54..3d8a7c831 100644 --- a/site/examples/embeds.js +++ b/site/examples/embeds.js @@ -63,16 +63,11 @@ const VideoElement = ({ attributes, children, element }) => { }} /> - e.stopPropagation()} - style={{ - marginTop: '5px', - boxSizing: 'border-box', - }} - onChange={e => { + { const path = ReactEditor.findPath(editor, element) - Transforms.setNodes(editor, { url: e.target.value }, { at: path }) + Transforms.setNodes(editor, { url: val }, { at: path }) }} /> @@ -81,6 +76,25 @@ const VideoElement = ({ attributes, children, element }) => { ) } +const UrlInput = ({ url, onChange }) => { + const [value, setValue] = React.useState(url) + return ( + e.stopPropagation()} + style={{ + marginTop: '5px', + boxSizing: 'border-box', + }} + onChange={e => { + const newUrl = e.target.value + setValue(newUrl) + onChange(newUrl) + }} + /> + ) +} + const initialValue = [ { children: [