From aabcf75d0eaedae46571f8ef6f04fc2e63439d5f Mon Sep 17 00:00:00 2001 From: gaber Date: Thu, 11 Jul 2024 07:14:20 +0300 Subject: [PATCH 1/3] fix mentions not copy to clipboard --- package-lock.json | 8 ++++---- package.json | 2 +- src/libs/Clipboard/index.ts | 7 +++++-- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/package-lock.json b/package-lock.json index c401dfe77198..9a2cea929335 100644 --- a/package-lock.json +++ b/package-lock.json @@ -55,7 +55,7 @@ "date-fns-tz": "^2.0.0", "dom-serializer": "^0.2.2", "domhandler": "^4.3.0", - "expensify-common": "2.0.26", + "expensify-common": "2.0.39", "expo": "^50.0.3", "expo-av": "~13.10.4", "expo-image": "1.11.0", @@ -25974,9 +25974,9 @@ } }, "node_modules/expensify-common": { - "version": "2.0.26", - "resolved": "https://registry.npmjs.org/expensify-common/-/expensify-common-2.0.26.tgz", - "integrity": "sha512-3GORs2xfx78SoKLDh4lXpk4Bx61sAVNnlo23VB803zs7qZz8/Oq3neKedtEJuRAmUps0C1Y5y9xZE8nrPO31nQ==", + "version": "2.0.39", + "resolved": "https://registry.npmjs.org/expensify-common/-/expensify-common-2.0.39.tgz", + "integrity": "sha512-HyW7MiS8+ZWO2xye5TSsiKJfIsaGl0M2RlI+txJNF9GWeroA6kaXybTY1Ppq+cS+a7+MU/KMQh7GNnIMrvkf+w==", "dependencies": { "awesome-phonenumber": "^5.4.0", "classnames": "2.5.0", diff --git a/package.json b/package.json index 5420a3e886ef..0c7631f0c914 100644 --- a/package.json +++ b/package.json @@ -109,7 +109,7 @@ "date-fns-tz": "^2.0.0", "dom-serializer": "^0.2.2", "domhandler": "^4.3.0", - "expensify-common": "2.0.26", + "expensify-common": "2.0.39", "expo": "^50.0.3", "expo-av": "~13.10.4", "expo-image": "1.11.0", diff --git a/src/libs/Clipboard/index.ts b/src/libs/Clipboard/index.ts index 512eebce78e2..6ccc0fb3b9cd 100644 --- a/src/libs/Clipboard/index.ts +++ b/src/libs/Clipboard/index.ts @@ -115,11 +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(//gi, '') + .replace(//gi, ''); + navigator.clipboard.write([ new ClipboardItem({ /* eslint-disable @typescript-eslint/naming-convention */ - 'text/html': new Blob([html], {type: 'text/html'}), - 'text/plain': new Blob([text], {type: 'text/plain'}), + 'text/html': new Blob([htmlNonClosingTags], {type: 'text/html'}), + 'text/plain': new Blob([htmlNonClosingTags], {type: 'text/plain'}), }), ]); } From 50710360a7c1b78e43beb02f02703227304245ee Mon Sep 17 00:00:00 2001 From: gaber Date: Thu, 11 Jul 2024 07:39:03 +0300 Subject: [PATCH 2/3] prettier --- src/libs/Clipboard/index.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libs/Clipboard/index.ts b/src/libs/Clipboard/index.ts index 6ccc0fb3b9cd..9c49b1e70da5 100644 --- a/src/libs/Clipboard/index.ts +++ b/src/libs/Clipboard/index.ts @@ -115,7 +115,8 @@ 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(//gi, '') + const htmlNonClosingTags = html + .replace(//gi, '') .replace(//gi, ''); navigator.clipboard.write([ From 6df586a08083ff3af97cbaf380eeb629f4a759c5 Mon Sep 17 00:00:00 2001 From: gaber Date: Thu, 11 Jul 2024 18:17:32 +0300 Subject: [PATCH 3/3] fix clipboard setHtml text --- src/libs/Clipboard/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/Clipboard/index.ts b/src/libs/Clipboard/index.ts index 9c49b1e70da5..130aad270b92 100644 --- a/src/libs/Clipboard/index.ts +++ b/src/libs/Clipboard/index.ts @@ -123,7 +123,7 @@ const setHtml: SetHtml = (html: string, text: string) => { new ClipboardItem({ /* eslint-disable @typescript-eslint/naming-convention */ 'text/html': new Blob([htmlNonClosingTags], {type: 'text/html'}), - 'text/plain': new Blob([htmlNonClosingTags], {type: 'text/plain'}), + 'text/plain': new Blob([text], {type: 'text/plain'}), }), ]); }