mirror of
https://github.com/zadam/trilium.git
synced 2025-11-08 22:35:50 +01:00
left sidebar can now be also collapsible
This commit is contained in:
@@ -145,38 +145,33 @@ if (utils.isElectron()) {
|
||||
import("./services/spell_check.js").then(spellCheckService => spellCheckService.initSpellCheck());
|
||||
}
|
||||
|
||||
const rightPane = $("#right-pane");
|
||||
optionService.waitForOptions().then(options => {
|
||||
toggleSidebar('left', options.is('leftPaneVisible'));
|
||||
toggleSidebar('right', options.is('rightPaneVisible'));
|
||||
|
||||
const $showRightPaneButton = $("#show-right-pane-button");
|
||||
const $hideRightPaneButton = $("#hide-right-pane-button");
|
||||
|
||||
optionService.waitForOptions().then(options => toggleSidebar(options.is('rightPaneVisible')));
|
||||
|
||||
function toggleSidebar(show) {
|
||||
rightPane.toggle(show);
|
||||
$showRightPaneButton.toggle(!show);
|
||||
$hideRightPaneButton.toggle(show);
|
||||
|
||||
if (show) {
|
||||
splitService.setupSplitWithSidebar();
|
||||
}
|
||||
else {
|
||||
splitService.setupSplitWithoutSidebar();
|
||||
}
|
||||
}
|
||||
|
||||
$hideRightPaneButton.on('click', () => {
|
||||
toggleSidebar(false);
|
||||
|
||||
server.put('options/rightPaneVisible/false');
|
||||
splitService.setupSplit(paneVisible.left, paneVisible.right);
|
||||
});
|
||||
|
||||
$showRightPaneButton.on('click', async () => {
|
||||
toggleSidebar(true);
|
||||
const paneVisible = {};
|
||||
|
||||
await server.put('options/rightPaneVisible/true');
|
||||
function toggleSidebar(side, show) {
|
||||
$(`#${side}-pane`).toggle(show);
|
||||
$(`#show-${side}-pane-button`).toggle(!show);
|
||||
$(`#hide-${side}-pane-button`).toggle(show);
|
||||
|
||||
const {sidebar} = appContext.getActiveTabContext();
|
||||
await sidebar.noteLoaded();
|
||||
sidebar.show();
|
||||
});
|
||||
paneVisible[side] = show;
|
||||
}
|
||||
|
||||
function toggleAndSave(side, show) {
|
||||
toggleSidebar(side, show);
|
||||
|
||||
splitService.setupSplit(paneVisible.left, paneVisible.right);
|
||||
|
||||
server.put(`options/${side}PaneVisible/` + show.toString());
|
||||
}
|
||||
|
||||
$("#show-right-pane-button").on('click', () => toggleAndSave('right', true));
|
||||
$("#hide-right-pane-button").on('click', () => toggleAndSave('right', false));
|
||||
|
||||
$("#show-left-pane-button").on('click', () => toggleAndSave('left', true));
|
||||
$("#hide-left-pane-button").on('click', () => toggleAndSave('left', false));
|
||||
|
||||
Reference in New Issue
Block a user