From 18e7301550aa502373dc10428722047567cbe6c8 Mon Sep 17 00:00:00 2001 From: Gabriel <63877012+Gabrielcefetzada@users.noreply.github.com> Date: Tue, 27 Feb 2024 15:28:01 -0300 Subject: [PATCH] feat: add middle mouse button click to close tab (#1649) * feat: add middle click button to close tab * refactor: remove unused code * fix: verify if is middle click before trigger close confirmation modal --- .../RequestTabs/RequestTab/index.js | 26 ++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/packages/bruno-app/src/components/RequestTabs/RequestTab/index.js b/packages/bruno-app/src/components/RequestTabs/RequestTab/index.js index b6c8ce693..a067e9876 100644 --- a/packages/bruno-app/src/components/RequestTabs/RequestTab/index.js +++ b/packages/bruno-app/src/components/RequestTabs/RequestTab/index.js @@ -28,6 +28,19 @@ const RequestTab = ({ tab, collection }) => { ); }; + const handleMouseUp = (e) => { + if (e.button === 1) { + e.stopPropagation(); + e.preventDefault(); + + dispatch( + closeTabs({ + tabUids: [tab.uid] + }) + ); + } + }; + const getMethodColor = (method = '') => { const theme = storedTheme === 'dark' ? darkTheme : lightTheme; @@ -124,7 +137,18 @@ const RequestTab = ({ tab, collection }) => { }} /> )} -