From 41218181246c87e8fb50565ee597d5c9b35b6349 Mon Sep 17 00:00:00 2001 From: Danny Avila Date: Thu, 25 Apr 2024 00:10:41 -0400 Subject: [PATCH] =?UTF-8?q?=E2=9C=8D=EF=B8=8F=20fix(useTextarea):=20Rich?= =?UTF-8?q?=20Text=20Format=20paste=20from=20MS=20Word=20(#2530)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/src/hooks/Input/useTextarea.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/client/src/hooks/Input/useTextarea.ts b/client/src/hooks/Input/useTextarea.ts index 4f8e6f7a93..0edc8be060 100644 --- a/client/src/hooks/Input/useTextarea.ts +++ b/client/src/hooks/Input/useTextarea.ts @@ -180,15 +180,17 @@ export default function useTextarea({ return; } + let richText = ''; let includedText = ''; const { types } = e.clipboardData; if (types.indexOf('text/rtf') !== -1 || types.indexOf('Files') !== -1) { e.preventDefault(); includedText = e.clipboardData.getData('text/plain'); + richText = e.clipboardData.getData('text/rtf'); } - if (includedText && e.clipboardData.files.length > 0) { + if (includedText && (e.clipboardData.files.length > 0 || richText)) { insertTextAtCursor(textAreaRef.current, includedText); forceResize(textAreaRef); }