converting sidebar widgets to normal widgets

This commit is contained in:
zadam
2020-01-14 21:23:32 +01:00
parent 23701219e1
commit c9770573b2
14 changed files with 99 additions and 126 deletions

View File

@@ -5,7 +5,6 @@ import bundleService from "./bundle.js";
import Attributes from "./attributes.js";
import utils from "./utils.js";
import optionsService from "./options.js";
import Sidebar from "./sidebar.js";
import appContext from "./app_context.js";
let showSidebarInNewTab = true;
@@ -39,14 +38,6 @@ class TabContext {
this.noteChangeDisabled = false;
this.isNoteChanged = false;
this.attributes = new Attributes(this);
if (utils.isDesktop()) {
const sidebarState = this.state.sidebar || {
visible: showSidebarInNewTab
};
this.sidebar = new Sidebar(this, sidebarState);
}
}
async setNote(note, notePath) {
@@ -70,10 +61,6 @@ class TabContext {
this.setCurrentNotePathToHash();
if (this.sidebar) {
this.sidebar.noteLoaded(); // load async
}
this.noteChangeDisabled = true;
try {
@@ -118,10 +105,6 @@ class TabContext {
}
}
if (this.sidebar) {
this.sidebar.show();
}
this.setCurrentNotePathToHash();
this.setTitleBar();
}
@@ -254,10 +237,6 @@ class TabContext {
await this.saveNoteIfChanged();
this.$tabContent.remove();
}
if (this.sidebar) {
this.sidebar.remove();
}
}
cleanup() {
@@ -274,10 +253,6 @@ class TabContext {
}
this.attributes.eventReceived(name, data);
if (this.sidebar) {
this.sidebar.eventReceived(name, data);
}
}
getTabState() {
@@ -288,8 +263,7 @@ class TabContext {
return {
tabId: this.tabId,
notePath: this.notePath,
active: this.tabRow.activeTabEl === this.$tab[0],
sidebar: this.sidebar && this.sidebar.getSidebarState()
active: this.tabRow.activeTabEl === this.$tab[0]
}
}