mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-10-04 20:21:31 +08:00
fix(sidebar): split being visible when collapsed
This commit is contained in:
parent
d74c5ea2a1
commit
1893f2ea80
@ -1,3 +1,4 @@
|
||||
import type { OptionNames } from "../../../services/options_interface.js";
|
||||
import type { AttributeType } from "../entities/fattribute.js";
|
||||
import type { EntityChange } from "../server_types.js";
|
||||
|
||||
@ -182,7 +183,7 @@ export default class LoadResults {
|
||||
this.optionNames.push(name);
|
||||
}
|
||||
|
||||
isOptionReloaded(name: string) {
|
||||
isOptionReloaded(name: OptionNames) {
|
||||
return this.optionNames.includes(name);
|
||||
}
|
||||
|
||||
|
@ -31,14 +31,12 @@ function setupLeftPaneResizer(leftPaneVisible: boolean) {
|
||||
}
|
||||
}
|
||||
|
||||
function setupRightPaneResizer() {
|
||||
function setupRightPaneResizer(rightPaneVisible: boolean) {
|
||||
if (rightInstance) {
|
||||
rightInstance.destroy();
|
||||
rightInstance = null;
|
||||
}
|
||||
|
||||
const rightPaneVisible = $("#right-pane").is(":visible");
|
||||
|
||||
if (!rightPaneVisible) {
|
||||
$("#center-pane").css("width", "100%");
|
||||
|
||||
|
@ -1,4 +1,7 @@
|
||||
import splitService from "../../services/resizer.js";
|
||||
import options from "../../services/options.js";
|
||||
import CommandButtonWidget from "./command_button.js";
|
||||
import type { EventData } from "../../components/app_context.js";
|
||||
|
||||
export default class RightPaneToggleWidget extends CommandButtonWidget {
|
||||
|
||||
@ -11,4 +14,16 @@ export default class RightPaneToggleWidget extends CommandButtonWidget {
|
||||
this.settings.command = "toggleRightPane";
|
||||
}
|
||||
|
||||
refreshIcon(): void {
|
||||
super.refreshIcon();
|
||||
|
||||
splitService.setupRightPaneResizer(options.is("rightPaneVisible"));
|
||||
}
|
||||
|
||||
entitiesReloadedEvent({ loadResults }: EventData<"entitiesReloaded">) {
|
||||
if (loadResults.isOptionReloaded("rightPaneVisible")) {
|
||||
this.refreshIcon();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -36,16 +36,7 @@ export default class RightPaneContainer extends FlexContainer<RightPanelWidget>
|
||||
}
|
||||
|
||||
reEvaluateRightPaneVisibilityCommand() {
|
||||
const newToggle = this.isEnabled();
|
||||
|
||||
if (newToggle) {
|
||||
this.toggleInt(newToggle);
|
||||
|
||||
splitService.setupRightPaneResizer();
|
||||
console.log("Toggle on")
|
||||
} else {
|
||||
console.log("Toggle of")
|
||||
}
|
||||
this.toggleInt(this.isEnabled());
|
||||
}
|
||||
|
||||
entitiesReloadedEvent({ loadResults }: EventData<"entitiesReloaded">) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user