From 9444e04a2323e6fbfa176e4dacc783c300a8a463 Mon Sep 17 00:00:00 2001 From: Piyush Bhatt <2023kuec2027@iiitkota.ac.in> Date: Sun, 2 Feb 2025 11:15:56 +0530 Subject: [PATCH 1/3] handlePasteImages --- .../react/src/views/ChatInput/ChatInput.js | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/packages/react/src/views/ChatInput/ChatInput.js b/packages/react/src/views/ChatInput/ChatInput.js index 34ebffb86f..3cd85022b5 100644 --- a/packages/react/src/views/ChatInput/ChatInput.js +++ b/packages/react/src/views/ChatInput/ChatInput.js @@ -449,6 +449,40 @@ const ChatInput = ({ scrollToBottom }) => { break; } }; + const handlePasteImages = (e) => { + const { items } = e.clipboardData; + Array.from(items).forEach((item) => { + if (item.type.indexOf('image') !== -1) { + const imageBlob = item.getAsFile(); + const file = new File( + [imageBlob], + `Clipboard- ${new Date().toLocaleString('en-US', { + year: 'numeric', + month: 'long', + day: 'numeric', + hour: 'numeric', + minute: 'numeric', + })}.png`, + { + type: imageBlob.type, + lastModified: Date.now(), + } + ); + + toggle(); + setData(file); + e.preventDefault(); + } + }); + }; + + useEffect(() => { + const inputElement = messageRef.current; + inputElement.addEventListener('paste', handlePasteImages); + return () => { + inputElement.removeEventListener('paste', handlePasteImages); + }; + }); return ( From 1267cfc984d39b02f541eaa3ad1eedd6e57e7a53 Mon Sep 17 00:00:00 2001 From: Piyush Bhatt <2023kuec2027@iiitkota.ac.in> Date: Sun, 2 Feb 2025 11:43:01 +0530 Subject: [PATCH 2/3] fix --- .github/workflows/playwright.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml index 088f92dcdb..a222725ecd 100644 --- a/.github/workflows/playwright.yml +++ b/.github/workflows/playwright.yml @@ -52,7 +52,7 @@ jobs: run: cd packages/e2e-react && npx playwright test - name: Upload Playwright report - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: always() with: name: playwright-report From 6200265c6686f65b0c8b2d3c61d01caf012b49f2 Mon Sep 17 00:00:00 2001 From: Zishan Ahmad Date: Sun, 2 Feb 2025 14:22:04 +0530 Subject: [PATCH 3/3] reset to older action --- .github/workflows/playwright.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml index a222725ecd..088f92dcdb 100644 --- a/.github/workflows/playwright.yml +++ b/.github/workflows/playwright.yml @@ -52,7 +52,7 @@ jobs: run: cd packages/e2e-react && npx playwright test - name: Upload Playwright report - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v3 if: always() with: name: playwright-report