mirror of
https://github.com/usebruno/bruno.git
synced 2024-11-23 00:13:24 +01:00
Merge pull request #599 from game5413/fix/collection-dropdown
fix: event mouse up triggered when hold mouse click at anywhere and release at sidebar
This commit is contained in:
commit
79be625fb5
@ -88,8 +88,6 @@ const CollectionItem = ({ item, collection, searchText }) => {
|
||||
});
|
||||
|
||||
const handleClick = (event) => {
|
||||
switch (event.button) {
|
||||
case 0: // left click
|
||||
if (isItemARequest(item)) {
|
||||
dispatch(hideHomePage());
|
||||
if (itemIsOpenedInTabs(item, tabs)) {
|
||||
@ -115,8 +113,9 @@ const CollectionItem = ({ item, collection, searchText }) => {
|
||||
collectionUid: collection.uid
|
||||
})
|
||||
);
|
||||
return;
|
||||
case 2: // right click
|
||||
};
|
||||
|
||||
const handleRightClick = (event) => {
|
||||
const _menuDropdown = dropdownTippyRef.current;
|
||||
if (_menuDropdown) {
|
||||
let menuDropdownBehavior = 'show';
|
||||
@ -125,8 +124,6 @@ const CollectionItem = ({ item, collection, searchText }) => {
|
||||
}
|
||||
_menuDropdown[menuDropdownBehavior]();
|
||||
}
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
const handleDoubleClick = (event) => {
|
||||
@ -203,7 +200,8 @@ const CollectionItem = ({ item, collection, searchText }) => {
|
||||
? indents.map((i) => {
|
||||
return (
|
||||
<div
|
||||
onMouseUp={handleClick}
|
||||
onClick={handleClick}
|
||||
onContextMenu={handleRightClick}
|
||||
onDoubleClick={handleDoubleClick}
|
||||
className="indent-block"
|
||||
key={i}
|
||||
@ -219,7 +217,8 @@ const CollectionItem = ({ item, collection, searchText }) => {
|
||||
})
|
||||
: null}
|
||||
<div
|
||||
onMouseUp={handleClick}
|
||||
onClick={handleClick}
|
||||
onContextMenu={handleRightClick}
|
||||
onDoubleClick={handleDoubleClick}
|
||||
className="flex flex-grow items-center h-full overflow-hidden"
|
||||
style={{
|
||||
|
@ -66,12 +66,11 @@ const Collection = ({ collection, searchText }) => {
|
||||
});
|
||||
|
||||
const handleClick = (event) => {
|
||||
const _menuDropdown = menuDropdownTippyRef.current;
|
||||
switch (event.button) {
|
||||
case 0: // left click
|
||||
dispatch(collectionClicked(collection.uid));
|
||||
return;
|
||||
case 2: // right click
|
||||
};
|
||||
|
||||
const handleRightClick = (event) => {
|
||||
const _menuDropdown = menuDropdownTippyRef.current;
|
||||
if (_menuDropdown) {
|
||||
let menuDropdownBehavior = 'show';
|
||||
if (_menuDropdown.state.isShown) {
|
||||
@ -79,8 +78,6 @@ const Collection = ({ collection, searchText }) => {
|
||||
}
|
||||
_menuDropdown[menuDropdownBehavior]();
|
||||
}
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
const handleExportClick = () => {
|
||||
@ -138,7 +135,11 @@ const Collection = ({ collection, searchText }) => {
|
||||
<CollectionProperties collection={collection} onClose={() => setCollectionPropertiesModal(false)} />
|
||||
)}
|
||||
<div className="flex py-1 collection-name items-center" ref={drop}>
|
||||
<div className="flex flex-grow items-center overflow-hidden" onMouseUp={handleClick}>
|
||||
<div
|
||||
className="flex flex-grow items-center overflow-hidden"
|
||||
onClick={handleClick}
|
||||
onContextMenu={handleRightClick}
|
||||
>
|
||||
<IconChevronRight
|
||||
size={16}
|
||||
strokeWidth={2}
|
||||
|
Loading…
Reference in New Issue
Block a user