mirror of
https://github.com/quine-global/hyper.git
synced 2026-01-14 20:58:41 -09:00
Fix middle mouse click tab close (#2230)
This commit is contained in:
parent
8524d37f9e
commit
af68171528
1 changed files with 10 additions and 3 deletions
|
|
@ -7,7 +7,8 @@ export default class Tab extends React.PureComponent {
|
|||
this.handleHover = this.handleHover.bind(this);
|
||||
this.handleBlur = this.handleBlur.bind(this);
|
||||
this.handleClick = this.handleClick.bind(this);
|
||||
|
||||
this.handleMouseUp = this.handleMouseUp.bind(this);
|
||||
|
||||
this.state = {
|
||||
hovered: false
|
||||
};
|
||||
|
|
@ -27,11 +28,16 @@ export default class Tab extends React.PureComponent {
|
|||
|
||||
handleClick(event) {
|
||||
const isLeftClick = event.nativeEvent.which === 1;
|
||||
const isMiddleClick = event.nativeEvent.which === 2;
|
||||
|
||||
if (isLeftClick && !this.props.isActive) {
|
||||
this.props.onSelect();
|
||||
} else if (isMiddleClick) {
|
||||
}
|
||||
}
|
||||
|
||||
handleMouseUp(event) {
|
||||
const isMiddleClick = event.nativeEvent.which === 2;
|
||||
|
||||
if (isMiddleClick) {
|
||||
this.props.onClose();
|
||||
}
|
||||
}
|
||||
|
|
@ -55,6 +61,7 @@ export default class Tab extends React.PureComponent {
|
|||
<span
|
||||
className={`tab_text ${isLast ? 'tab_textLast' : ''} ${isActive ? 'tab_textActive' : ''}`}
|
||||
onClick={this.handleClick}
|
||||
onMouseUp={this.handleMouseUp}
|
||||
>
|
||||
<span title={this.props.text} className="tab_textInner">
|
||||
{this.props.text}
|
||||
|
|
|
|||
Loading…
Reference in a new issue