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:
@@ -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)
|
||||
}}
|
||||
>
|
||||
|
Reference in New Issue
Block a user