mirror of
https://github.com/zadam/trilium.git
synced 2025-11-11 15:55:52 +01:00
refactoring of pane => split, "pane" keeps its old meaning (left-pane, center-pane, right-pane)
This commit is contained in:
39
src/public/app/widgets/buttons/left_pane_toggle.js
Normal file
39
src/public/app/widgets/buttons/left_pane_toggle.js
Normal file
@@ -0,0 +1,39 @@
|
||||
import ButtonWidget from "./button_widget.js";
|
||||
import options from "../../services/options.js";
|
||||
import splitService from "../../services/split.js";
|
||||
|
||||
export default class LeftPaneToggleWidget extends ButtonWidget {
|
||||
refreshIcon() {
|
||||
const isLeftPaneVisible = options.is('leftPaneVisible');
|
||||
|
||||
this.settings.icon = isLeftPaneVisible
|
||||
? "bx-chevrons-left"
|
||||
: "bx-chevrons-right";
|
||||
|
||||
this.settings.title = isLeftPaneVisible
|
||||
? "Hide sidebar."
|
||||
: "Open sidebar.";
|
||||
|
||||
this.settings.command = isLeftPaneVisible
|
||||
? "hideSidebar"
|
||||
: "showSidebar";
|
||||
|
||||
super.refreshIcon();
|
||||
|
||||
splitService.setupSplit(isLeftPaneVisible);
|
||||
}
|
||||
|
||||
hideSidebarCommand() {
|
||||
options.save(`leftPaneVisible`, "false");
|
||||
}
|
||||
|
||||
showSidebarCommand() {
|
||||
options.save(`leftPaneVisible`, "true");
|
||||
}
|
||||
|
||||
entitiesReloadedEvent({loadResults}) {
|
||||
if (loadResults.isOptionReloaded("leftPaneVisible")) {
|
||||
this.refreshIcon();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user