feat(nvim-tree): incorrect double click detection
This commit is contained in:
@@ -16,21 +16,17 @@ export const NvimTreeChild = (props: {
|
|||||||
const handleClick = () => {
|
const handleClick = () => {
|
||||||
props.onSelect(props.y);
|
props.onSelect(props.y);
|
||||||
|
|
||||||
if (lastClick) {
|
if (lastClick && Date.now() - lastClick <= 500) {
|
||||||
if (Date.now() - lastClick <= 500) {
|
|
||||||
props.onOpen(props.child);
|
props.onOpen(props.child);
|
||||||
}
|
}
|
||||||
|
|
||||||
setLastClick(undefined);
|
|
||||||
} else {
|
|
||||||
setLastClick(Date.now());
|
setLastClick(Date.now());
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<li
|
<li
|
||||||
style={{ background: props.selected ? "#504651" : "" }}
|
style={{ background: props.selected ? "#504651" : "" }}
|
||||||
onMouseDown={handleClick}
|
onClick={handleClick}
|
||||||
>
|
>
|
||||||
{" "}
|
{" "}
|
||||||
{props.inDirectory && (
|
{props.inDirectory && (
|
||||||
|
|||||||
Reference in New Issue
Block a user