Skip to content

Build your personal knowledge base with Trilium Notes

ELIAN HELPED ME

perf3ct023f0b607d4f
diff --git a/src/public/app/desktop.ts b/src/public/app/desktop.ts
index 9c8d4cd22e..0251324950 100644
--- a/src/public/app/desktop.ts
+++ b/src/public/app/desktop.ts
@@ -11,7 +11,6 @@ import options from "./services/options.js";
import type ElectronRemote from "@electron/remote";
import type Electron from "electron";
import "../stylesheets/bootstrap.scss";
-import rightPaneTabManager from "./services/right_pane_tab_manager.js";
await appContext.earlyInit();
diff --git a/src/public/app/layouts/desktop_layout.ts b/src/public/app/layouts/desktop_layout.ts
index cc892e2b3f..5745df470e 100644
--- a/src/public/app/layouts/desktop_layout.ts
+++ b/src/public/app/layouts/desktop_layout.ts
@@ -87,7 +87,6 @@ import utils from "../services/utils.js";
import GeoMapButtons from "../widgets/floating_buttons/geo_map_button.js";
import ContextualHelpButton from "../widgets/floating_buttons/help_button.js";
import CloseZenButton from "../widgets/close_zen_button.js";
-import rightPaneTabManager from "../services/right_pane_tab_manager.js";
import type { AppContext } from "./../components/app_context.js";
import type { WidgetsByParent } from "../services/bundle.js";
import SwitchSplitOrientationButton from "../widgets/floating_buttons/switch_layout_button.js";
@@ -246,7 +245,6 @@ export default class DesktopLayout {
)
.child(
new RightPaneContainer()
- .id("right-pane-container")
.child(new TocWidget())
.child(new HighlightsListWidget())
.child(...this.customWidgets.get("right-pane"))
diff --git a/src/public/app/services/right_pane_tab_manager.js b/src/public/app/services/right_pane_tab_manager.js
deleted file mode 100644
index c8df13b60c..0000000000
--- a/src/public/app/services/right_pane_tab_manager.js
+++ /dev/null
@@ -1,127 +0,0 @@
-/**
- * Manager for tabs in the right pane
- */
-class RightPaneTabManager {
- constructor() {
- this.tabs = [];
- this.activeTab = null;
- this.$tabContainer = null;
- this.$contentContainer = null;
- this.initialized = false;
- }
-
- /**
- * Initialize the tab manager with container elements
- */
- init($tabContainer, $contentContainer) {
- this.$tabContainer = $tabContainer;
- this.$contentContainer = $contentContainer;
- this.initialized = true;
- this.renderTabs();
- }
-
- /**
- * Add a new tab context
- */
- addTabContext(tabContext) {
- this.tabs.push(tabContext);
-
- if (this.initialized) {
- this.renderTabs();
-
- // If this is the first tab, activate it
- if (this.tabs.length === 1) {
- this.activateTab(tabContext);
- }
- }
- }
-
- /**
- * Render all tabs
- */
- renderTabs() {
- if (!this.initialized) return;
-
- this.$tabContainer.empty();
-
- for (const tab of this.tabs) {
- const $tab = $('<div class="right-pane-tab"></div>')
- .attr('data-tab-id', this.tabs.indexOf(tab))
- .append(tab.renderTitle(tab.title))
- .toggleClass('active', tab === this.activeTab)
- .on('click', () => {
- this.activateTab(tab);
- });
-
- this.$tabContainer.append($tab);
- }
- }
-
- /**
- * Activate a specific tab
- */
- activateTab(tabContext) {
- if (this.activeTab === tabContext) return;
-
- // Deactivate current tab
- if (this.activeTab) {
- this.activeTab.deactivate();
- }
-
- // Activate new tab
- this.activeTab = tabContext;
- tabContext.activate();
-
- // Update UI
- if (this.initialized) {
- this.renderTabs();
- this.renderContent();
- }
- }
-
- /**
- * Render the content of the active tab
- */
- renderContent() {
- if (!this.initialized || !this.activeTab) return;
-
- this.$contentContainer.empty();
-
- const widget = this.activeTab.widget;
- if (widget) {
- if (typeof widget.render === 'function') {
- const $renderedWidget = widget.render();
- this.$contentContainer.append($renderedWidget);
- } else if (widget instanceof jQuery) {
- this.$contentContainer.append(widget);
- } else if (widget.nodeType) {
- this.$contentContainer.append($(widget));
- }
- }
- }
-
- /**
- * Remove a tab
- */
- removeTab(tabContext) {
- const index = this.tabs.indexOf(tabContext);
- if (index !== -1) {
- this.tabs.splice(index, 1);
-
- if (this.activeTab === tabContext) {
- this.activeTab = this.tabs.length > 0 ? this.tabs[0] : null;
- if (this.activeTab) {
- this.activeTab.activate();
- }
- }
-
- if (this.initialized) {
- this.renderTabs();
- this.renderContent();
- }
- }
- }
-}
-
-const rightPaneTabManager = new RightPaneTabManager();
-export default rightPaneTabManager;
diff --git a/src/public/app/widgets/right_panel_tabs.js b/src/public/app/widgets/right_panel_tabs.js
deleted file mode 100644
index 83660d3b10..0000000000
--- a/src/public/app/widgets/right_panel_tabs.js
+++ /dev/null
@@ -1,49 +0,0 @@
-/**
- * TabContext represents a tab in the right pane that can contain any widget
- */
-export default class TabContext {
- /**
- * @param {string} title - Tab title
- * @param {object} widget - Widget to display in the tab
- */
- constructor(title, widget) {
- this.title = title;
- this.widget = widget;
- this.active = false;
- }
-
- /**
- * Custom renderer for the tab title
- * @param {string} title
- * @returns {JQuery}
- */
- renderTitle(title) {
- return $(`<span class="tab-title">${title}</span>`);
- }
-
- /**
- * Activate this tab
- */
- activate() {
- this.active = true;
-
- if (this.widget && typeof this.widget.activeTabChanged === 'function') {
- this.widget.activeTabChanged(true);
- }
-
- if (typeof rightPaneTabManager.activateTab === 'function') {
- rightPaneTabManager.activateTab(this);
- }
- }
-
- /**
- * Deactivate this tab
- */
- deactivate() {
- this.active = false;
-
- if (this.widget && typeof this.widget.activeTabChanged === 'function') {
- this.widget.activeTabChanged(false);
- }
- }
-}