diff --git a/lib/client/vanilla/image.tsx b/lib/client/vanilla/image.tsx index c783d880..de3e7778 100644 --- a/lib/client/vanilla/image.tsx +++ b/lib/client/vanilla/image.tsx @@ -1,4 +1,4 @@ -import React, { useState, useRef, ChangeEvent } from 'react' +import React, { useState, useRef, ChangeEvent, useEffect } from 'react' import * as DialogPrimitive from '@radix-ui/react-dialog' @@ -19,6 +19,10 @@ const Dialog: React.FC = ({ open, setOpen, selectedElement, standal const [urlText, setUrlText] = useState('') const input = useRef(null) + useEffect(() => { + setUrl(selectedElement?.getAttribute('src') ?? '') + }, [open]) + const onUpload = async (e: React.ChangeEvent) => { e.preventDefault()