mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
left sidebar can now be also collapsible
This commit is contained in:
parent
c5475765e5
commit
0cc013c13f
6
package-lock.json
generated
6
package-lock.json
generated
@ -2661,9 +2661,9 @@
|
|||||||
"integrity": "sha512-7vmuyh5+kuUyJKePhQfRQBhXV5Ce+RnaeeQArKu1EAMpL3WbgMt5WG6uQZpEVvYSSsxMXRKOewtDk9RaTKXRlA=="
|
"integrity": "sha512-7vmuyh5+kuUyJKePhQfRQBhXV5Ce+RnaeeQArKu1EAMpL3WbgMt5WG6uQZpEVvYSSsxMXRKOewtDk9RaTKXRlA=="
|
||||||
},
|
},
|
||||||
"electron": {
|
"electron": {
|
||||||
"version": "8.0.0-beta.9",
|
"version": "8.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/electron/-/electron-8.0.0-beta.9.tgz",
|
"resolved": "https://registry.npmjs.org/electron/-/electron-8.0.0.tgz",
|
||||||
"integrity": "sha512-5aVB7ixySU5WF4p4NiGN/378idgOLSggEh80FfvKzbE5kKmegWA4m0mppkypwMWAVFzNcVubkI6vE0rerFQZKw==",
|
"integrity": "sha512-vBXUKRqTUq0jv1upvISdvScDDH3uCPwXj4eA5BeR3UDbJp2hOhq7eJxwjIQbfLQql98aYz4X6pSlzBnhfyQqHA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@electron/get": "^1.0.1",
|
"@electron/get": "^1.0.1",
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
"commonmark": "0.29.1",
|
"commonmark": "0.29.1",
|
||||||
"cookie-parser": "1.4.4",
|
"cookie-parser": "1.4.4",
|
||||||
"csurf": "1.11.0",
|
"csurf": "1.11.0",
|
||||||
"dayjs": "1.8.19",
|
"dayjs": "1.8.20",
|
||||||
"debug": "4.1.1",
|
"debug": "4.1.1",
|
||||||
"ejs": "2.7.4",
|
"ejs": "2.7.4",
|
||||||
"electron-debug": "3.0.1",
|
"electron-debug": "3.0.1",
|
||||||
@ -76,7 +76,7 @@
|
|||||||
"ws": "7.2.1"
|
"ws": "7.2.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"electron": "8.0.0-beta.9",
|
"electron": "8.0.0",
|
||||||
"electron-builder": "22.3.2",
|
"electron-builder": "22.3.2",
|
||||||
"electron-packager": "14.2.0",
|
"electron-packager": "14.2.0",
|
||||||
"electron-rebuild": "1.10.0",
|
"electron-rebuild": "1.10.0",
|
||||||
|
@ -145,38 +145,33 @@ if (utils.isElectron()) {
|
|||||||
import("./services/spell_check.js").then(spellCheckService => spellCheckService.initSpellCheck());
|
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");
|
splitService.setupSplit(paneVisible.left, paneVisible.right);
|
||||||
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');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$showRightPaneButton.on('click', async () => {
|
const paneVisible = {};
|
||||||
toggleSidebar(true);
|
|
||||||
|
|
||||||
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();
|
paneVisible[side] = show;
|
||||||
await sidebar.noteLoaded();
|
}
|
||||||
sidebar.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));
|
||||||
|
@ -196,8 +196,8 @@ class AppContext {
|
|||||||
|
|
||||||
this.components = [
|
this.components = [
|
||||||
new Entrypoints(),
|
new Entrypoints(),
|
||||||
this.tabRow,
|
|
||||||
new DialogEventComponent(this),
|
new DialogEventComponent(this),
|
||||||
|
...topPaneWidgets,
|
||||||
...leftPaneWidgets,
|
...leftPaneWidgets,
|
||||||
...centerPaneWidgets,
|
...centerPaneWidgets,
|
||||||
...rightPaneWidgets
|
...rightPaneWidgets
|
||||||
|
@ -12,40 +12,50 @@ async function getPaneWidths() {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
async function setupSplitWithSidebar() {
|
async function setupSplit(left, right) {
|
||||||
if (instance) {
|
if (instance) {
|
||||||
instance.destroy();
|
instance.destroy();
|
||||||
|
instance = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!left && !right) {
|
||||||
|
$("#center-pane").css('width', '100%');
|
||||||
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const {leftPaneWidth, rightPaneWidth} = await getPaneWidths();
|
const {leftPaneWidth, rightPaneWidth} = await getPaneWidths();
|
||||||
|
|
||||||
instance = Split(['#left-pane', '#center-pane', '#right-pane'], {
|
if (left && right) {
|
||||||
sizes: [leftPaneWidth, 100 - leftPaneWidth - rightPaneWidth, rightPaneWidth],
|
instance = Split(['#left-pane', '#center-pane', '#right-pane'], {
|
||||||
gutterSize: 5,
|
sizes: [leftPaneWidth, 100 - leftPaneWidth - rightPaneWidth, rightPaneWidth],
|
||||||
onDragEnd: sizes => {
|
gutterSize: 5,
|
||||||
server.put('options/leftPaneWidth/' + Math.round(sizes[0]));
|
onDragEnd: sizes => {
|
||||||
server.put('options/rightPaneWidth/' + Math.round(sizes[2]));
|
server.put('options/leftPaneWidth/' + Math.round(sizes[0]));
|
||||||
}
|
server.put('options/rightPaneWidth/' + Math.round(sizes[2]));
|
||||||
});
|
}
|
||||||
}
|
});
|
||||||
|
}
|
||||||
async function setupSplitWithoutSidebar() {
|
else if (left) {
|
||||||
if (instance) {
|
instance = Split(['#left-pane', '#center-pane'], {
|
||||||
instance.destroy();
|
sizes: [leftPaneWidth, 100 - leftPaneWidth],
|
||||||
|
gutterSize: 5,
|
||||||
|
onDragEnd: sizes => {
|
||||||
|
server.put('options/leftPaneWidth/' + Math.round(sizes[0]));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else if (right) {
|
||||||
|
instance = Split(['#center-pane', '#right-pane'], {
|
||||||
|
sizes: [100 - rightPaneWidth, rightPaneWidth],
|
||||||
|
gutterSize: 5,
|
||||||
|
onDragEnd: sizes => {
|
||||||
|
server.put('options/rightPaneWidth/' + Math.round(sizes[1]));
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const {leftPaneWidth} = await getPaneWidths();
|
|
||||||
|
|
||||||
instance = Split(['#left-pane', '#center-pane'], {
|
|
||||||
sizes: [leftPaneWidth, 100 - leftPaneWidth],
|
|
||||||
gutterSize: 5,
|
|
||||||
onDragEnd: sizes => {
|
|
||||||
server.put('options/leftPaneWidth/' + Math.round(sizes[0]));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
setupSplitWithSidebar,
|
setupSplit
|
||||||
setupSplitWithoutSidebar
|
|
||||||
};
|
};
|
@ -153,6 +153,13 @@ body {
|
|||||||
z-index: 1000;
|
z-index: 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#hide-left-pane-button, #show-left-pane-button {
|
||||||
|
position: fixed;
|
||||||
|
bottom: 10px;
|
||||||
|
left: 10px;
|
||||||
|
z-index: 1000;
|
||||||
|
}
|
||||||
|
|
||||||
#right-pane {
|
#right-pane {
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
padding-top: 4px;
|
padding-top: 4px;
|
||||||
|
@ -34,6 +34,7 @@ const ALLOWED_OPTIONS = new Set([
|
|||||||
'imageJpegQuality',
|
'imageJpegQuality',
|
||||||
'leftPaneWidth',
|
'leftPaneWidth',
|
||||||
'rightPaneWidth',
|
'rightPaneWidth',
|
||||||
|
'leftPaneVisible',
|
||||||
'rightPaneVisible',
|
'rightPaneVisible',
|
||||||
'nativeTitleBarVisible'
|
'nativeTitleBarVisible'
|
||||||
]);
|
]);
|
||||||
|
@ -78,6 +78,7 @@ const defaultOptions = [
|
|||||||
{ name: 'autoFixConsistencyIssues', value: 'true', isSynced: false },
|
{ name: 'autoFixConsistencyIssues', value: 'true', isSynced: false },
|
||||||
{ name: 'codeNotesMimeTypes', value: '["text/x-csrc","text/x-c++src","text/x-csharp","text/css","text/x-go","text/x-groovy","text/x-haskell","text/html","message/http","text/x-java","application/javascript;env=frontend","application/javascript;env=backend","application/json","text/x-kotlin","text/x-markdown","text/x-perl","text/x-php","text/x-python","text/x-ruby",null,"text/x-sql","text/x-swift","text/xml","text/x-yaml"]', isSynced: true },
|
{ name: 'codeNotesMimeTypes', value: '["text/x-csrc","text/x-c++src","text/x-csharp","text/css","text/x-go","text/x-groovy","text/x-haskell","text/html","message/http","text/x-java","application/javascript;env=frontend","application/javascript;env=backend","application/json","text/x-kotlin","text/x-markdown","text/x-perl","text/x-php","text/x-python","text/x-ruby",null,"text/x-sql","text/x-swift","text/xml","text/x-yaml"]', isSynced: true },
|
||||||
{ name: 'leftPaneWidth', value: '25', isSynced: false },
|
{ name: 'leftPaneWidth', value: '25', isSynced: false },
|
||||||
|
{ name: 'leftPaneVisible', value: 'true', isSynced: false },
|
||||||
{ name: 'rightPaneWidth', value: '25', isSynced: false },
|
{ name: 'rightPaneWidth', value: '25', isSynced: false },
|
||||||
{ name: 'rightPaneVisible', value: 'true', isSynced: false },
|
{ name: 'rightPaneVisible', value: 'true', isSynced: false },
|
||||||
{ name: 'nativeTitleBarVisible', value: 'false', isSynced: false },
|
{ name: 'nativeTitleBarVisible', value: 'false', isSynced: false },
|
||||||
|
@ -13,17 +13,18 @@
|
|||||||
<div id="container" style="display: none;">
|
<div id="container" style="display: none;">
|
||||||
<div id="top-pane"></div>
|
<div id="top-pane"></div>
|
||||||
|
|
||||||
<div style="display: flex; flex-grow: 1; flex-shrink: 1; min-height: 0;">
|
<div id="main-pane" style="display: flex; flex-grow: 1; flex-shrink: 1; min-height: 0;">
|
||||||
<div id="left-pane" class="hide-in-zen-mode"></div>
|
<button id="hide-left-pane-button" class="btn btn-sm icon-button bx bx-chevrons-left hide-in-zen-mode" title="Show sidebar"></button>
|
||||||
|
<button id="show-left-pane-button" class="btn btn-sm icon-button bx bx-chevrons-right hide-in-zen-mode" title="Hide sidebar"></button>
|
||||||
|
|
||||||
|
<div id="left-pane"></div>
|
||||||
|
|
||||||
<div id="center-pane"></div>
|
<div id="center-pane"></div>
|
||||||
|
|
||||||
<button id="hide-right-pane-button" class="btn btn-sm icon-button bx bx-chevrons-right hide-in-zen-mode" title="Hide sidebar"></button>
|
<button id="hide-right-pane-button" class="btn btn-sm icon-button bx bx-chevrons-right hide-in-zen-mode" title="Hide sidebar"></button>
|
||||||
<button id="show-right-pane-button" class="btn btn-sm icon-button bx bx-chevrons-left hide-in-zen-mode" title="Show sidebar"></button>
|
<button id="show-right-pane-button" class="btn btn-sm icon-button bx bx-chevrons-left hide-in-zen-mode" title="Show sidebar"></button>
|
||||||
|
|
||||||
<div id="right-pane" class="hide-in-zen-mode">
|
<div id="right-pane"></div>
|
||||||
<div id="sidebar-container"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="dropdown-menu dropdown-menu-sm" id="context-menu-container"></div>
|
<div class="dropdown-menu dropdown-menu-sm" id="context-menu-container"></div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user