Remove ui.isEditing, enable forcing desktop window open without sidebar

This commit is contained in:
Tom Moor
2022-12-04 11:55:33 -05:00
parent cd29cd3aec
commit d16133fda8
4 changed files with 26 additions and 28 deletions

View File

@@ -6,6 +6,9 @@ import Storage from "~/utils/Storage";
const UI_STORE = "UI_STORE";
// Whether the window launched with sidebar force hidden
let sidebarHidden = window.location.search.includes("sidebarHidden=true");
export enum Theme {
Light = "light",
Dark = "dark",
@@ -45,9 +48,6 @@ class UiStore {
@observable
progressBarVisible = false;
@observable
isEditing = false;
@observable
tocVisible = false;
@@ -164,11 +164,13 @@ class UiStore {
@action
expandSidebar = () => {
sidebarHidden = false;
this.sidebarCollapsed = false;
};
@action
toggleCollapsedSidebar = () => {
sidebarHidden = false;
this.sidebarCollapsed = !this.sidebarCollapsed;
};
@@ -182,16 +184,6 @@ class UiStore {
this.tocVisible = false;
};
@action
enableEditMode = () => {
this.isEditing = true;
};
@action
disableEditMode = () => {
this.isEditing = false;
};
@action
enableProgressBar = () => {
this.progressBarVisible = true;
@@ -222,6 +214,16 @@ class UiStore {
this.mobileSidebarVisible = false;
};
/**
* Returns the current state of the sidebar taking into account user preference
* and whether the sidebar has been hidden as part of launching in a new
* desktop window.
*/
@computed
get sidebarIsClosed() {
return this.sidebarCollapsed || sidebarHidden;
}
@computed
get resolvedTheme(): Theme | SystemTheme {
if (this.theme === "system") {