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.handleConnectSubmit = this.handleConnectSubmit.bind(this);
|
||||||
this.handleJoinSubmit = this.handleJoinSubmit.bind(this);
|
this.handleJoinSubmit = this.handleJoinSubmit.bind(this);
|
||||||
this.handleBufferListClick = this.handleBufferListClick.bind(this);
|
this.handleBufferListClick = this.handleBufferListClick.bind(this);
|
||||||
|
this.handleBufferListClose = this.handleBufferListClose.bind(this);
|
||||||
this.toggleBufferList = this.toggleBufferList.bind(this);
|
this.toggleBufferList = this.toggleBufferList.bind(this);
|
||||||
this.toggleMemberList = this.toggleMemberList.bind(this);
|
this.toggleMemberList = this.toggleMemberList.bind(this);
|
||||||
this.handleComposerSubmit = this.handleComposerSubmit.bind(this);
|
this.handleComposerSubmit = this.handleComposerSubmit.bind(this);
|
||||||
|
@ -1095,6 +1096,11 @@ export default class App extends Component {
|
||||||
this.closeBufferList();
|
this.closeBufferList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
handleBufferListClose(id) {
|
||||||
|
this.close(id);
|
||||||
|
this.closeBufferList();
|
||||||
|
}
|
||||||
|
|
||||||
toggleBufferList() {
|
toggleBufferList() {
|
||||||
this.setState((state) => {
|
this.setState((state) => {
|
||||||
let openPanels = {
|
let openPanels = {
|
||||||
|
@ -1430,6 +1436,7 @@ export default class App extends Component {
|
||||||
isBouncer=${isBouncer}
|
isBouncer=${isBouncer}
|
||||||
activeBuffer=${this.state.activeBuffer}
|
activeBuffer=${this.state.activeBuffer}
|
||||||
onBufferClick=${this.handleBufferListClick}
|
onBufferClick=${this.handleBufferListClick}
|
||||||
|
onBufferClose=${this.handleBufferListClose}
|
||||||
/>
|
/>
|
||||||
<button
|
<button
|
||||||
class="expander"
|
class="expander"
|
||||||
|
|
|
@ -7,6 +7,12 @@ function BufferItem(props) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
props.onClick();
|
props.onClick();
|
||||||
}
|
}
|
||||||
|
function handleMouseDown(event) {
|
||||||
|
if (event.button === 1) { // middle click
|
||||||
|
event.preventDefault();
|
||||||
|
props.onClose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let name = props.buffer.name;
|
let name = props.buffer.name;
|
||||||
if (props.buffer.type == BufferType.SERVER) {
|
if (props.buffer.type == BufferType.SERVER) {
|
||||||
|
@ -23,7 +29,11 @@ function BufferItem(props) {
|
||||||
|
|
||||||
return html`
|
return html`
|
||||||
<li class="${classes.join(" ")}">
|
<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>
|
</li>
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
@ -47,6 +57,7 @@ export default function BufferList(props) {
|
||||||
isBouncer=${props.isBouncer}
|
isBouncer=${props.isBouncer}
|
||||||
bouncerNetwork=${bouncerNetwork}
|
bouncerNetwork=${bouncerNetwork}
|
||||||
onClick=${() => props.onBufferClick(buf)}
|
onClick=${() => props.onBufferClick(buf)}
|
||||||
|
onClose=${() => props.onBufferClose(buf)}
|
||||||
active=${props.activeBuffer == buf.id}
|
active=${props.activeBuffer == buf.id}
|
||||||
/>
|
/>
|
||||||
`;
|
`;
|
||||||
|
|
Loading…
Reference in a new issue