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);