Skip to content

Commit

Permalink
Return after handlePastedImage throws an error
Browse files Browse the repository at this point in the history
This is stops unnecessary onchange update when pasting an image that causes an error (e.g. paste throws an error when screen shot is too large in Abitti)
This caused a bug in Abitti where the "Too large screenshot" error disappeared immediately from the UI because of the empty update to RTE
  • Loading branch information
SamiSaves committed Nov 29, 2024
1 parent f2118df commit e88bfd5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/app/components/text-area/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,9 @@ const MainTextArea = forwardRef<RichTextEditorHandle, TextAreaProps>((props, ref
const img = document.createElement('img')
img.src = src
document.execCommand('insertHTML', false, sanitize(img.outerHTML))
} catch (e) {
console.error(e)
} catch (error) {
console.error('Error while pasting a file', error)
return
}
} else if (html) {
document.execCommand('insertHTML', false, sanitize(html))
Expand Down

0 comments on commit e88bfd5

Please sign in to comment.