From e88bfd5caee19d7487be2d9dde1517bfeda9a12c Mon Sep 17 00:00:00 2001 From: Sami Saves Date: Fri, 29 Nov 2024 13:38:53 +0200 Subject: [PATCH] Return after handlePastedImage throws an error 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 --- src/app/components/text-area/index.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/app/components/text-area/index.tsx b/src/app/components/text-area/index.tsx index fe292f58..88844ca5 100644 --- a/src/app/components/text-area/index.tsx +++ b/src/app/components/text-area/index.tsx @@ -110,8 +110,9 @@ const MainTextArea = forwardRef((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))