don't try to activate the pane being currently removed

This commit is contained in:
zadam 2021-10-13 23:27:58 +02:00
parent f505f9d65a
commit 53875d26bc
2 changed files with 10 additions and 4 deletions

View File

@ -26,16 +26,16 @@ export default class ButtonWidget extends NoteContextAwareWidget {
this.$widget = $(TPL);
if (this.settings.onClick) {
this.$widget.on("click", () => {
this.$widget.on("click", e => {
this.$widget.tooltip("hide");
this.settings.onClick(this)
this.settings.onClick(this, e);
});
} else {
this.$widget.on("click", () => {
this.$widget.tooltip("hide");
this.triggerCommand(this.settings.command)
this.triggerCommand(this.settings.command);
});
}

View File

@ -13,6 +13,12 @@ export default class ClosePaneButton extends ButtonWidget {
this.icon("bx-x")
.title("Close this pane")
.titlePlacement("bottom")
.onClick(widget => widget.triggerCommand("closeThisNoteSplit", { ntxId: widget.getNtxId() }));
.onClick((widget, e) => {
// to avoid split pane container detecting click within the pane which would try to activate this
// pane (which is being removed)
e.stopPropagation();
widget.triggerCommand("closeThisNoteSplit", { ntxId: widget.getNtxId() });
});
}
}