option to configure if sidebar should be enabled in new tab

This commit is contained in:
zadam
2019-08-19 23:29:42 +02:00
parent 9888850c22
commit b818f020a7
7 changed files with 49 additions and 3 deletions

View File

@@ -17,6 +17,7 @@ import noteDetailRender from "./note_detail_render.js";
import noteDetailRelationMap from "./note_detail_relation_map.js";
import noteDetailProtectedSession from "./note_detail_protected_session.js";
import protectedSessionService from "./protected_session.js";
import optionsInitService from "./options_init.js";
import linkService from "./link.js";
import Sidebar from "./sidebar.js";
@@ -34,6 +35,12 @@ const componentClasses = {
'protected-session': noteDetailProtectedSession
};
let showSidebarInNewTab = true;
optionsInitService.addLoadListener(options => {
showSidebarInNewTab = options.showSidebarInNewTab === '1';
});
class TabContext {
/**
* @param {TabRow} tabRow
@@ -64,7 +71,11 @@ class TabContext {
this.attributes = new Attributes(this);
if (utils.isDesktop()) {
this.sidebar = new Sidebar(this, state.sidebar);
const sidebarState = state.sidebar || {
visible: showSidebarInNewTab
};
this.sidebar = new Sidebar(this, sidebarState);
this.noteType = new NoteTypeContext(this);
}