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:
Anoop M D 2023-10-18 22:53:15 +05:30 committed by GitHub
commit 79be625fb5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 50 additions and 50 deletions

View File

@ -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={{

View File

@ -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}