Skip to content

Commit

Permalink
Check if url exists
Browse files Browse the repository at this point in the history
  • Loading branch information
Gustavo Rocha authored Dec 3, 2022
1 parent a41aa1f commit e97cee7
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions demos/src/Nodes/Youtube/React/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,13 @@ const MenuBar = ({ editor }) => {
const addYoutubeVideo = () => {
const url = prompt('Enter YouTube URL')

editor.commands.setYoutubeVideo({
src: url,
width: Math.max(320, parseInt(widthRef.current.value, 10)) || 640,
height: Math.max(180, parseInt(heightRef.current.value, 10)) || 480,
})
if (url) {
editor.commands.setYoutubeVideo({
src: url,
width: Math.max(320, parseInt(widthRef.current.value, 10)) || 640,
height: Math.max(180, parseInt(heightRef.current.value, 10)) || 480,
})
}
}

return (
Expand Down

0 comments on commit e97cee7

Please sign in to comment.