Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
sidebar skeleton
zadam5283b489dc13
diff --git a/src/public/javascripts/desktop.js b/src/public/javascripts/desktop.jsindex 73b389ef8b..8310796660 100644--- a/src/public/javascripts/desktop.js+++ b/src/public/javascripts/desktop.js@@ -42,6 +42,7 @@ import noteAutocompleteService from './services/note_autocomplete.js';import macInit from './services/mac_init.js';import cssLoader from './services/css_loader.js';import dateNoteService from './services/date_notes.js';+import sidebarService from './services/sidebar.js';window.glob.isDesktop = utils.isDesktop;window.glob.isMobile = utils.isMobile;diff --git a/src/public/javascripts/services/sidebar.js b/src/public/javascripts/services/sidebar.jsnew file mode 100644index 0000000000..030934f85e--- /dev/null+++ b/src/public/javascripts/services/sidebar.js@@ -0,0 +1,25 @@+class Sidebar {+ /**+ * @param {TabContext} ctx+ */+ constructor(ctx) {+ this.ctx = ctx;+ this.$sidebar = ctx.$tabContent.find(".note-detail-sidebar");+ this.$showSideBarButton = this.ctx.$tabContent.find(".show-sidebar-button");+ this.$showSideBarButton.hide();++ this.$hideSidebarButton = this.$sidebar.find(".hide-sidebar-button");++ this.$hideSidebarButton.click(() => {+ this.$sidebar.hide();+ this.$showSideBarButton.show();+ });++ this.$showSideBarButton.click(() => {+ this.$sidebar.show();+ this.$showSideBarButton.hide();+ })+ }+}++export default Sidebar;\ No newline at end of filediff --git a/src/public/javascripts/services/tab_context.js b/src/public/javascripts/services/tab_context.jsindex d2d35e758a..a12cf59089 100644--- a/src/public/javascripts/services/tab_context.js+++ b/src/public/javascripts/services/tab_context.js@@ -18,6 +18,7 @@ import noteDetailRelationMap from "./note_detail_relation_map.js";import noteDetailProtectedSession from "./note_detail_protected_session.js";import protectedSessionService from "./protected_session.js";import linkService from "./link.js";+import Sidebar from "./sidebar.js";const $tabContentsContainer = $("#note-tab-container");@@ -59,6 +60,7 @@ class TabContext {this.noteChangeDisabled = false;this.isNoteChanged = false;this.attributes = new Attributes(this);+ this.sidebar = new Sidebar(this);if (utils.isDesktop()) {this.noteType = new NoteTypeContext(this);diff --git a/src/public/stylesheets/style.css b/src/public/stylesheets/style.cssindex d1639dbbd2..fe2a1757b7 100644--- a/src/public/stylesheets/style.css+++ b/src/public/stylesheets/style.css@@ -103,11 +103,49 @@ ul.fancytree-container {}.note-tab-content {+ display: flex;+ flex-direction: row;+ height: 100%;+ width: 100%;+}++.note-detail-content {display: flex;flex-direction: column;height: 100%;}+.note-detail-sidebar {+ min-width: 300px;+ overflow: auto;+ padding-top: 12px;+ padding-left: 7px;+}++.note-detail-sidebar .card {+ border: 0;+}++.note-detail-sidebar .card-header {+ background: inherit;+ padding: 0;+ border: 0;+}++.note-detail-sidebar .card-header button {++}++.note-detail-sidebar .card-header h5 {+ font-size: 1rem;+}++.note-detail-sidebar .card-body {+ max-width: 300px;+ padding: 8px;+ border: 0;+}+.note-detail-component-wrapper {flex-grow: 100;position: relative;diff --git a/src/views/desktop.ejs b/src/views/desktop.ejsindex 1dedf66fcb..da2232a457 100644--- a/src/views/desktop.ejs+++ b/src/views/desktop.ejs@@ -6,7 +6,7 @@</head><body class="desktop theme-<%= theme %>" style="--main-font-size: <%= mainFontSize %>%; --tree-font-size: <%= treeFontSize %>%; --detail-font-size: <%= detailFontSize %>%;"><noscript>Trilium requires JavaScript to be enabled.</noscript>-<div id="container" style="display: none; grid-template-columns: minmax(<%= leftPaneMinWidth %>px, <%= leftPaneWidthPercent %>fr) minmax(0, <%= rightPaneWidthPercent %>fr)">+<div id="container" style="display: none; grid-template-columns: <%= leftPaneWidthPercent %>fr <%= rightPaneWidthPercent %>fr"><div id="header" class="hide-toggle"><div id="history-navigation" style="display: none;"><a id="history-back-button" title="Go to previous note." class="icon-action jam jam-arrow-square-left"></a>@@ -106,7 +106,7 @@</div></div>- <div id="left-pane" class="hide-toggle">+ <div id="left-pane" class="hide-toggle" style="resize: horizontal; overflow: scroll;"><div id="global-buttons"><a id="create-top-level-note-button" title="Create new top level note" class="icon-action jam jam-plus-circle"></a>diff --git a/src/views/sidebar.ejs b/src/views/sidebar.ejsnew file mode 100644index 0000000000..a481b4b760--- /dev/null+++ b/src/views/sidebar.ejs@@ -0,0 +1,49 @@+<div class="note-detail-sidebar">+ <div style="text-align: center; margin-bottom: 10px;">+ <button class="hide-sidebar-button" style="background: none; border: none;">hide sidebar <span class="jam jam-chevron-right"></span></button>+ </div>++ <div class="card">+ <div class="card-header" id="headingOne">+ <h5 class="mb-0">+ <button class="btn btn-sm" data-toggle="collapse" data-target="#collapseOne" aria-expanded="true" aria-controls="collapseOne">+ Collapsible Group Item #1+ </button>+ </h5>+ </div>++ <div id="collapseOne" class="collapse show" aria-labelledby="headingOne">+ <div class="card-body">+ Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.+ </div>+ </div>+ </div>+ <div class="card">+ <div class="card-header" id="headingTwo">+ <h5 class="mb-0">+ <button class="btn btn-sm collapsed" data-toggle="collapse" data-target="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo">+ Collapsible Group Item #2+ </button>+ </h5>+ </div>+ <div id="collapseTwo" class="collapse" aria-labelledby="headingTwo">+ <div class="card-body">+ Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.+ </div>+ </div>+ </div>+ <div class="card">+ <div class="card-header" id="headingThree">+ <h5 class="mb-0">+ <button class="btn btn-sm collapsed" data-toggle="collapse" data-target="#collapseThree" aria-expanded="false" aria-controls="collapseThree">+ Collapsible Group Item #3+ </button>+ </h5>+ </div>+ <div id="collapseThree" class="collapse" aria-labelledby="headingThree">+ <div class="card-body">+ Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.+ </div>+ </div>+ </div>+</div>\ No newline at end of filediff --git a/src/views/tabs.ejs b/src/views/tabs.ejsindex d8766f8896..4dc72b1e7c 100644--- a/src/views/tabs.ejs+++ b/src/views/tabs.ejs@@ -4,42 +4,46 @@<div id="note-tab-container"><div class="note-tab-content note-tab-content-template">- <% include title.ejs %>+ <div class="note-detail-content">+ <% include title.ejs %>- <div class="note-detail-script-area"></div>+ <div class="note-detail-script-area"></div>- <table class="note-detail-promoted-attributes"></table>+ <table class="note-detail-promoted-attributes"></table>- <div class="note-detail-component-wrapper">- <div class="note-detail-text note-detail-component">- <div class="note-detail-text-editor" tabindex="10000"></div>- </div>+ <div class="note-detail-component-wrapper">+ <div class="note-detail-text note-detail-component">+ <div class="note-detail-text-editor" tabindex="10000"></div>+ </div>- <div class="note-detail-code note-detail-component">- <div class="note-detail-code-editor"></div>- </div>+ <div class="note-detail-code note-detail-component">+ <div class="note-detail-code-editor"></div>+ </div>- <% include details/empty.ejs %>+ <% include details/empty.ejs %>- <% include details/search.ejs %>+ <% include details/search.ejs %>- <% include details/render.ejs %>+ <% include details/render.ejs %>- <% include details/file.ejs %>+ <% include details/file.ejs %>- <% include details/image.ejs %>+ <% include details/image.ejs %>- <% include details/relation_map.ejs %>+ <% include details/relation_map.ejs %>- <% include details/protected_session_password.ejs %>+ <% include details/protected_session_password.ejs %>- <div class="children-overview"></div>- </div>+ <div class="children-overview"></div>+ </div>- <div class="attribute-list">- <button class="btn btn-sm show-attributes-button">Attributes:</button>+ <div class="attribute-list">+ <button class="btn btn-sm show-attributes-button">Attributes:</button>- <span class="attribute-list-inner"></span>+ <span class="attribute-list-inner"></span>+ </div></div>++ <% include sidebar.ejs %></div></div>\ No newline at end of filediff --git a/src/views/title.ejs b/src/views/title.ejsindex 5e7cc743d2..e150a4c2e4 100644--- a/src/views/title.ejs+++ b/src/views/title.ejs@@ -73,6 +73,8 @@<a class="dropdown-item show-note-info-button">Note info</a></div></div>++ <button class="btn btn-sm icon-button jam jam-chevron-left show-sidebar-button" title="Show sidebar"></button></div></div></div>