How to upload a photo to the server in SunEditor using onImageUploadBefore?

I need to upload a photo to the server so that the image with the path is displayed in the editor. I wrote the function, everything works, the photo is uploaded to the server and displayed in the editor. But the editor displays two photos, one with the path from the server, the second in base64 format, how can I make sure that photos in base64 format are not displayed.

const TextSunEditor = ({
    onChange,
    value
}) => {

    async function handleImageUploadBefore(files, info, uploadHandler){
        console.log(files, info)

        const currentFile = files[0];

        const res = await FileUpload.upload(currentFile);

        if (res.statusCode === 200) {
            const { url } = res.content;
            uploadHandler({
                result: [{ url }],
            });
            toast.success(res.message)
        } else {
            toast.error(res.message)
        }
    }

  return (
    <SunEditor 
        setOptions={{
          height: 400,
          buttonList: [
            ['undo', 'redo'],
            ['bold', 'italic', 'underline', 'strike'],
            ['font', 'fontSize', 'formatBlock'],
            ['paragraphStyle', 'blockquote'],
            ['fontColor', 'hiliteColor', 'textStyle'],
            ['removeFormat'],
            '/',
            ['outdent', 'indent'],
            ['align', 'horizontalRule', 'list', 'lineHeight'],
            ['link', 'image', 'video'],
            ['fullScreen', 'showBlocks', 'codeView'],
            ['preview', 'print']
          ],
        }}
        onImageUploadBefore={handleImageUploadBefore}
        onChange={onChange}
        setContents={value}
      />
  )
}