Check if url exists (#3484)

This commit is contained in:
Gustavo Rocha 2022-12-06 20:46:28 -03:00 committed by GitHub
parent 8b854b67a4
commit 14fb467bc8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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 (