mirror of
https://git.sr.ht/~emersion/gamja
synced 2024-11-14 19:25:26 -05:00
Close buffer tabs on middle click
This commit is contained in:
parent
a31976586c
commit
34aea84dde
2 changed files with 19 additions and 1 deletions
|
@ -153,6 +153,7 @@ export default class App extends Component {
|
|||
this.handleConnectSubmit = this.handleConnectSubmit.bind(this);
|
||||
this.handleJoinSubmit = this.handleJoinSubmit.bind(this);
|
||||
this.handleBufferListClick = this.handleBufferListClick.bind(this);
|
||||
this.handleBufferListClose = this.handleBufferListClose.bind(this);
|
||||
this.toggleBufferList = this.toggleBufferList.bind(this);
|
||||
this.toggleMemberList = this.toggleMemberList.bind(this);
|
||||
this.handleComposerSubmit = this.handleComposerSubmit.bind(this);
|
||||
|
@ -1095,6 +1096,11 @@ export default class App extends Component {
|
|||
this.closeBufferList();
|
||||
}
|
||||
|
||||
handleBufferListClose(id) {
|
||||
this.close(id);
|
||||
this.closeBufferList();
|
||||
}
|
||||
|
||||
toggleBufferList() {
|
||||
this.setState((state) => {
|
||||
let openPanels = {
|
||||
|
@ -1430,6 +1436,7 @@ export default class App extends Component {
|
|||
isBouncer=${isBouncer}
|
||||
activeBuffer=${this.state.activeBuffer}
|
||||
onBufferClick=${this.handleBufferListClick}
|
||||
onBufferClose=${this.handleBufferListClose}
|
||||
/>
|
||||
<button
|
||||
class="expander"
|
||||
|
|
|
@ -7,6 +7,12 @@ function BufferItem(props) {
|
|||
event.preventDefault();
|
||||
props.onClick();
|
||||
}
|
||||
function handleMouseDown(event) {
|
||||
if (event.button === 1) { // middle click
|
||||
event.preventDefault();
|
||||
props.onClose();
|
||||
}
|
||||
}
|
||||
|
||||
let name = props.buffer.name;
|
||||
if (props.buffer.type == BufferType.SERVER) {
|
||||
|
@ -23,7 +29,11 @@ function BufferItem(props) {
|
|||
|
||||
return html`
|
||||
<li class="${classes.join(" ")}">
|
||||
<a href=${getBufferURL(props.buffer)} onClick=${handleClick}>${name}</a>
|
||||
<a
|
||||
href=${getBufferURL(props.buffer)}
|
||||
onClick=${handleClick}
|
||||
onMouseDown=${handleMouseDown}
|
||||
>${name}</a>
|
||||
</li>
|
||||
`;
|
||||
}
|
||||
|
@ -47,6 +57,7 @@ export default function BufferList(props) {
|
|||
isBouncer=${props.isBouncer}
|
||||
bouncerNetwork=${bouncerNetwork}
|
||||
onClick=${() => props.onBufferClick(buf)}
|
||||
onClose=${() => props.onBufferClose(buf)}
|
||||
active=${props.activeBuffer == buf.id}
|
||||
/>
|
||||
`;
|
||||
|
|
Loading…
Reference in a new issue