trilium/src/public/app/widgets/buttons/close_pane_button.js
2021-05-24 22:29:49 +02:00

19 lines
538 B
JavaScript

import ButtonWidget from "./button_widget.js";
export default class ClosePaneButton extends ButtonWidget {
isEnabled() {
return super.isEnabled()
// main note context should not be closeable
&& this.noteContext && !!this.noteContext.mainNtxId;
}
constructor() {
super();
this.icon("bx-x")
.title("Close this pane")
.titlePlacement("bottom")
.onClick(widget => widget.triggerCommand("closeThisPane", { ntxId: widget.getNtxId() }));
}
}