mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-10-04 12:11:30 +08:00
feat(layout): implement hide/show pane
This commit is contained in:
parent
2883942d87
commit
d74c5ea2a1
@ -104,6 +104,8 @@ export type CommandMappings = {
|
||||
openNoteInNewWindow: CommandData;
|
||||
hideLeftPane: CommandData;
|
||||
showLeftPane: CommandData;
|
||||
toggleLeftPane: CommandData;
|
||||
toggleRightPane: CommandData;
|
||||
|
||||
openInTab: ContextMenuCommandData;
|
||||
openNoteInSplit: ContextMenuCommandData;
|
||||
|
@ -86,6 +86,10 @@ export default class RootCommandExecutor extends Component {
|
||||
options.toggle("leftPaneVisible");
|
||||
}
|
||||
|
||||
toggleRightPaneCommand() {
|
||||
options.toggle("rightPaneVisible");
|
||||
}
|
||||
|
||||
async showBackendLogCommand() {
|
||||
await appContext.tabManager.openTabWithNoteWithHoisting("_backendLog", { activate: true });
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ export default class RightPaneToggleWidget extends CommandButtonWidget {
|
||||
this.class("toggle-button");
|
||||
this.css("transform", "scaleX(-1)");
|
||||
this.settings.icon = "bx-sidebar";
|
||||
this.settings.command = "toggleRightPane";
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -2,9 +2,9 @@ import FlexContainer from "./flex_container.js";
|
||||
import splitService from "../../services/resizer.js";
|
||||
import type RightPanelWidget from "../right_panel_widget.js";
|
||||
import type { EventData, EventNames } from "../../components/app_context.js";
|
||||
import options from "../../services/options.js";
|
||||
|
||||
export default class RightPaneContainer extends FlexContainer<RightPanelWidget> {
|
||||
private rightPaneHidden: boolean;
|
||||
|
||||
constructor() {
|
||||
super("column");
|
||||
@ -12,12 +12,10 @@ export default class RightPaneContainer extends FlexContainer<RightPanelWidget>
|
||||
this.id("right-pane");
|
||||
this.css("height", "100%");
|
||||
this.collapsible();
|
||||
|
||||
this.rightPaneHidden = false;
|
||||
}
|
||||
|
||||
isEnabled() {
|
||||
return super.isEnabled() && !this.rightPaneHidden;
|
||||
return super.isEnabled() && options.is("rightPaneVisible");
|
||||
}
|
||||
|
||||
handleEventInChildren<T extends EventNames>(name: T, data: EventData<T>): Promise<unknown[] | unknown> | null {
|
||||
@ -50,9 +48,11 @@ export default class RightPaneContainer extends FlexContainer<RightPanelWidget>
|
||||
}
|
||||
}
|
||||
|
||||
toggleRightPaneEvent() {
|
||||
this.rightPaneHidden = !this.rightPaneHidden;
|
||||
|
||||
this.reEvaluateRightPaneVisibilityCommand();
|
||||
entitiesReloadedEvent({ loadResults }: EventData<"entitiesReloaded">) {
|
||||
if (loadResults.isOptionReloaded("rightPaneVisible")) {
|
||||
const visible = this.isEnabled();
|
||||
this.toggleInt(visible);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user