Skip to content

Commit

Permalink
Merge pull request #45233 from ahmedGaber93/issue-40477
Browse files Browse the repository at this point in the history
fix mentions not copy to clipboard
  • Loading branch information
lakchote authored Jul 12, 2024
2 parents 491d8dd + 6c922b8 commit b5f8bd3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
"date-fns-tz": "^2.0.0",
"dom-serializer": "^0.2.2",
"domhandler": "^4.3.0",
"expensify-common": "2.0.35",
"expensify-common": "2.0.39",
"expo": "^50.0.3",
"expo-av": "~13.10.4",
"expo-image": "1.11.0",
Expand Down
6 changes: 5 additions & 1 deletion src/libs/Clipboard/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,14 @@ const setHtml: SetHtml = (html: string, text: string) => {
// See https://webkit.org/blog/10855/async-clipboard-api/ for more details.
setHTMLSync(html, text);
} else {
const htmlNonClosingTags = html
.replace(/<mention-report reportID="(\d+)" *\/>/gi, '<mention-report reportID="$1"></mention-report>')
.replace(/<mention-user accountID="(\d+)" *\/>/gi, '<mention-user accountID="$1"></mention-user>');

navigator.clipboard.write([
new ClipboardItem({
/* eslint-disable @typescript-eslint/naming-convention */
'text/html': new Blob([html], {type: 'text/html'}),
'text/html': new Blob([htmlNonClosingTags], {type: 'text/html'}),
'text/plain': new Blob([text], {type: 'text/plain'}),
}),
]);
Expand Down

0 comments on commit b5f8bd3

Please sign in to comment.