1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-19 05:31:56 +02:00

Added isImageUrl validation to button, added alert when not image (#3933)

* Added isImageUrl validation to button, added alert when not image

* Fixed lint error
This commit is contained in:
kenzobanaag
2021-03-31 15:03:36 -07:00
committed by GitHub
parent b57422b0e6
commit 2db9a36f93

View File

@@ -116,7 +116,10 @@ const InsertImageButton = () => {
onMouseDown={event => {
event.preventDefault()
const url = window.prompt('Enter the URL of the image:')
if (!url) return
if (url && !isImageUrl(url)) {
alert('URL is not an image')
return
}
insertImage(editor, url)
}}
>