mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 18:08:33 +02:00
show/hide switcher for the sidebar
This commit is contained in:
parent
d29c5c4758
commit
15aaead7b9
@ -31,6 +31,7 @@ import dateNoteService from './services/date_notes.js';
|
|||||||
import sidebarService from './services/sidebar.js';
|
import sidebarService from './services/sidebar.js';
|
||||||
import importService from './services/import.js';
|
import importService from './services/import.js';
|
||||||
import keyboardActionService from "./services/keyboard_actions.js";
|
import keyboardActionService from "./services/keyboard_actions.js";
|
||||||
|
import splitService from "./services/split.js";
|
||||||
|
|
||||||
window.glob.isDesktop = utils.isDesktop;
|
window.glob.isDesktop = utils.isDesktop;
|
||||||
window.glob.isMobile = utils.isMobile;
|
window.glob.isMobile = utils.isMobile;
|
||||||
@ -174,6 +175,8 @@ noteTooltipService.setupGlobalTooltip();
|
|||||||
|
|
||||||
noteAutocompleteService.init();
|
noteAutocompleteService.init();
|
||||||
|
|
||||||
|
splitService.setupSplitWithSidebar();
|
||||||
|
|
||||||
if (utils.isElectron()) {
|
if (utils.isElectron()) {
|
||||||
import("./services/spell_check.js").then(spellCheckService => spellCheckService.initSpellCheck());
|
import("./services/spell_check.js").then(spellCheckService => spellCheckService.initSpellCheck());
|
||||||
}
|
}
|
||||||
|
@ -286,11 +286,6 @@ function registerEntrypoints() {
|
|||||||
|
|
||||||
searchNotesService.searchInSubtree(node.data.noteId);
|
searchNotesService.searchInSubtree(node.data.noteId);
|
||||||
});
|
});
|
||||||
|
|
||||||
Split(['#left-pane', '#center-pane', '#right-pane'], {
|
|
||||||
sizes: [25, 50, 25],
|
|
||||||
gutterSize: 5
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
@ -1,22 +1,31 @@
|
|||||||
import bundleService from "./bundle.js";
|
import bundleService from "./bundle.js";
|
||||||
import ws from "./ws.js";
|
import ws from "./ws.js";
|
||||||
import optionsService from "./options.js";
|
import optionsService from "./options.js";
|
||||||
|
import splitService from "./split.js";
|
||||||
|
|
||||||
const $sidebar = $("#right-pane");
|
const $sidebar = $("#right-pane");
|
||||||
const $sidebarContainer = $sidebar.find('.sidebar-container');
|
const $sidebarContainer = $('#sidebar-container');
|
||||||
|
|
||||||
const $showSideBarButton = $sidebar.find(".show-sidebar-button");
|
const $showSideBarButton = $("#show-sidebar-button");
|
||||||
const $hideSidebarButton = $sidebar.find(".hide-sidebar-button");
|
const $hideSidebarButton = $("#hide-sidebar-button");
|
||||||
|
|
||||||
|
$showSideBarButton.hide();
|
||||||
|
|
||||||
$hideSidebarButton.on('click', () => {
|
$hideSidebarButton.on('click', () => {
|
||||||
$sidebar.hide();
|
$sidebar.hide();
|
||||||
$showSideBarButton.show();
|
$showSideBarButton.show();
|
||||||
|
$hideSidebarButton.hide();
|
||||||
|
|
||||||
|
splitService.setupSplitWithoutSidebar();
|
||||||
});
|
});
|
||||||
|
|
||||||
// FIXME shoud run note loaded!
|
// FIXME shoud run note loaded!
|
||||||
$showSideBarButton.on('click', () => {
|
$showSideBarButton.on('click', () => {
|
||||||
$sidebar.show();
|
$sidebar.show();
|
||||||
$showSideBarButton.hide();
|
$showSideBarButton.hide();
|
||||||
|
$hideSidebarButton.show();
|
||||||
|
|
||||||
|
splitService.setupSplitWithSidebar();
|
||||||
});
|
});
|
||||||
|
|
||||||
class Sidebar {
|
class Sidebar {
|
||||||
|
28
src/public/javascripts/services/split.js
Normal file
28
src/public/javascripts/services/split.js
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
let instance;
|
||||||
|
|
||||||
|
function setupSplitWithSidebar() {
|
||||||
|
if (instance) {
|
||||||
|
instance.destroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
instance = Split(['#left-pane', '#center-pane', '#right-pane'], {
|
||||||
|
sizes: [25, 50, 25],
|
||||||
|
gutterSize: 5
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function setupSplitWithoutSidebar() {
|
||||||
|
if (instance) {
|
||||||
|
instance.destroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
instance = Split(['#left-pane', '#center-pane'], {
|
||||||
|
sizes: [25, 75],
|
||||||
|
gutterSize: 5
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
setupSplitWithSidebar,
|
||||||
|
setupSplitWithoutSidebar
|
||||||
|
};
|
@ -398,16 +398,11 @@ body {
|
|||||||
transition: transform 120ms ease-in-out;
|
transition: transform 120ms ease-in-out;
|
||||||
}
|
}
|
||||||
|
|
||||||
.hide-sidebar-button {
|
#hide-sidebar-button, #show-sidebar-button {
|
||||||
color: var(--main-text-color);
|
position: fixed;
|
||||||
background: none;
|
bottom: 10px;
|
||||||
border: 1px solid transparent;
|
right: 10px;
|
||||||
padding: 2px 8px 2px 8px;
|
z-index: 100000;
|
||||||
border-radius: 2px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.hide-sidebar-button:hover {
|
|
||||||
border-color: var(--button-border-color);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#right-pane {
|
#right-pane {
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
<div id="right-pane" class="hide-in-zen-mode">
|
<button id="hide-sidebar-button" class="btn btn-sm icon-button bx bx-chevrons-right" title="Hide sidebar"></button>
|
||||||
<div style="text-align: center; margin-bottom: 5px;">
|
<button id="show-sidebar-button" class="btn btn-sm icon-button bx bx-chevrons-left" title="Show sidebar"></button>
|
||||||
<button class="hide-sidebar-button">hide sidebar <span class="bx bx-chevrons-right"></span></button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="sidebar-container">
|
<div id="right-pane" class="hide-in-zen-mode">
|
||||||
</div>
|
<div id="sidebar-container"></div>
|
||||||
</div>
|
</div>
|
@ -65,8 +65,6 @@
|
|||||||
<a class="dropdown-item show-note-info-button"><kbd data-kb-action="ShowNoteInfo"></kbd> Note info</a>
|
<a class="dropdown-item show-note-info-button"><kbd data-kb-action="ShowNoteInfo"></kbd> Note info</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<button class="btn btn-sm icon-button bx bx-chevrons-left show-sidebar-button" title="Show sidebar"></button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user