Skip to content

Commit ed18bfd

Browse files
committed
Revert "Merge pull request #55932 from prakashbask/fix/53718"
This reverts commit 4987f62, reversing changes made to beafd48.
1 parent ba9e3fc commit ed18bfd

File tree

2 files changed

+7
-11
lines changed

2 files changed

+7
-11
lines changed

src/hooks/useHtmlPaste/index.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import {useCallback, useEffect} from 'react';
2-
import {isMobile} from '@libs/Browser';
32
import Parser from '@libs/Parser';
43
import CONST from '@src/CONST';
54
import type UseHtmlPaste from './types';
@@ -90,14 +89,9 @@ const useHtmlPaste: UseHtmlPaste = (textInputRef, preHtmlPasteCallback, isActive
9089
*/
9190
const handlePastePlainText = useCallback(
9291
(event: ClipboardEvent) => {
93-
const markdownText = event.clipboardData?.getData('text/plain');
94-
// Updated paste logic to address issue #53718
95-
// When copying from a chat conversation, the clipboard contains markdown-formatted text.
96-
// On desktop web, users have the option to paste as plain text, but this feature is unavailable on mobile web.
97-
// A conditional check is added to determine whether to retain markdown or convert it to plain text based on the platform.
98-
if (markdownText) {
99-
const parsedText = isMobile() ? markdownText : Parser.htmlToText(Parser.replace(markdownText));
100-
paste(parsedText);
92+
const plainText = event.clipboardData?.getData('text/plain');
93+
if (plainText) {
94+
paste(plainText);
10195
}
10296
},
10397
[paste],

src/pages/home/report/ContextMenu/ContextMenuActions.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,10 @@ function setClipboardMessage(content: string | undefined) {
119119
if (!Clipboard.canSetHtml()) {
120120
Clipboard.setString(Parser.htmlToMarkdown(content));
121121
} else {
122-
const markdownText = Parser.htmlToMarkdown(content);
123-
Clipboard.setHtml(content, markdownText);
122+
const anchorRegex = CONST.REGEX_LINK_IN_ANCHOR;
123+
const isAnchorTag = anchorRegex.test(content);
124+
const plainText = isAnchorTag ? Parser.htmlToMarkdown(content) : Parser.htmlToText(content);
125+
Clipboard.setHtml(content, plainText);
124126
}
125127
}
126128

0 commit comments

Comments
 (0)