From 9ed76b256ea776650c4f8ffe703cfa0c2aceaa32 Mon Sep 17 00:00:00 2001 From: Prakash Baskaran Date: Thu, 6 Feb 2025 11:02:05 +0530 Subject: [PATCH] Fixed commit and added comment to explain the changes --- src/hooks/useHtmlPaste/index.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/hooks/useHtmlPaste/index.ts b/src/hooks/useHtmlPaste/index.ts index 690b64aeec3a..1a5606ef48ad 100644 --- a/src/hooks/useHtmlPaste/index.ts +++ b/src/hooks/useHtmlPaste/index.ts @@ -1,7 +1,7 @@ import {useCallback, useEffect} from 'react'; +import {isMobile} from '@libs/Browser'; import Parser from '@libs/Parser'; import CONST from '@src/CONST'; -import isMobile from '@src/utils/isMobile'; import type UseHtmlPaste from './types'; const insertAtCaret = (target: HTMLElement, insertedText: string, maxLength: number) => { @@ -91,6 +91,10 @@ const useHtmlPaste: UseHtmlPaste = (textInputRef, preHtmlPasteCallback, isActive const handlePastePlainText = useCallback( (event: ClipboardEvent) => { const markdownText = event.clipboardData?.getData('text/plain'); + // Updated paste logic to address issue #53718 + // When copying from a chat conversation, the clipboard contains markdown-formatted text. + // On desktop web, users have the option to paste as plain text, but this feature is unavailable on mobile web. + // A conditional check is added to determine whether to retain markdown or convert it to plain text based on the platform. if (markdownText) { const parsedText = isMobile() ? markdownText : Parser.htmlToText(Parser.replace(markdownText)); paste(parsedText);