frameless design with tabs on top, split for left panel

This commit is contained in:
zadam 2019-12-23 11:52:45 +01:00
parent 613d5f93e8
commit 7c8e7a3f4b
7 changed files with 87 additions and 45 deletions

View File

@ -52,6 +52,7 @@ async function createMainWindow() {
webPreferences: { webPreferences: {
nodeIntegration: true nodeIntegration: true
}, },
frame: false,
icon: path.join(__dirname, 'images/app-icons/png/256x256' + (env.isDev() ? '-dev' : '') + '.png') icon: path.join(__dirname, 'images/app-icons/png/256x256' + (env.isDev() ? '-dev' : '') + '.png')
}); });

3
libraries/split.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -286,6 +286,11 @@ function registerEntrypoints() {
searchNotesService.searchInSubtree(node.data.noteId); searchNotesService.searchInSubtree(node.data.noteId);
}); });
Split(['#left-pane', '#center-pane'], {
sizes: [25, 75],
gutterSize: 5
})
} }
export default { export default {

View File

@ -14,6 +14,7 @@ const Draggabilly = window.Draggabilly;
const TAB_CONTENT_MIN_WIDTH = 24; const TAB_CONTENT_MIN_WIDTH = 24;
const TAB_CONTENT_MAX_WIDTH = 240; const TAB_CONTENT_MAX_WIDTH = 240;
const NEW_TAB_WIDTH = 32; const NEW_TAB_WIDTH = 32;
const MIN_FILLER_WIDTH = 50;
const TAB_SIZE_SMALL = 84; const TAB_SIZE_SMALL = 84;
const TAB_SIZE_SMALLER = 60; const TAB_SIZE_SMALLER = 60;
@ -29,7 +30,9 @@ const tabTemplate = `
</div>`; </div>`;
const newTabButtonTemplate = `<div class="note-new-tab" title="Add new tab">+</div>`; const newTabButtonTemplate = `<div class="note-new-tab" title="Add new tab">+</div>`;
const fillerTemplate = `<div class="tab-row-filler"></div>`; const fillerTemplate = `<div class="tab-row-filler">
<div class="tab-row-border"></div>
</div>`;
class TabRow { class TabRow {
constructor(el) { constructor(el) {
@ -102,7 +105,7 @@ class TabRow {
get tabContentWidths() { get tabContentWidths() {
const numberOfTabs = this.tabEls.length; const numberOfTabs = this.tabEls.length;
const tabsContentWidth = this.tabContentEl.clientWidth - NEW_TAB_WIDTH; const tabsContentWidth = this.tabContentEl.clientWidth - NEW_TAB_WIDTH - MIN_FILLER_WIDTH;
const targetWidth = tabsContentWidth / numberOfTabs; const targetWidth = tabsContentWidth / numberOfTabs;
const clampedTargetWidth = Math.max(TAB_CONTENT_MIN_WIDTH, Math.min(TAB_CONTENT_MAX_WIDTH, targetWidth)); const clampedTargetWidth = Math.max(TAB_CONTENT_MIN_WIDTH, Math.min(TAB_CONTENT_MAX_WIDTH, targetWidth));
const flooredClampedTargetWidth = Math.floor(clampedTargetWidth); const flooredClampedTargetWidth = Math.floor(clampedTargetWidth);
@ -119,7 +122,7 @@ class TabRow {
} }
if (this.fillerEl) { if (this.fillerEl) {
this.fillerEl.style.width = extraWidthRemaining + "px"; this.fillerEl.style.width = (extraWidthRemaining + MIN_FILLER_WIDTH) + "px";
} }
return widths; return widths;

View File

@ -14,13 +14,31 @@ body {
display: none !important; display: none !important;
} }
.gutter {
background-color: var(--accented-background-color);
}
.gutter:hover {
background-color: var(--main-border-color);
}
.gutter.gutter-horizontal {
cursor: col-resize;
}
.gutter.gutter-vertical {
cursor: row-resize;
}
#center-pane { #center-pane {
display: flex; display: flex;
flex-direction: column;
} }
#note-tab-container { #note-tab-container {
min-height: 0; min-height: 0;
padding-left: 10px; padding-left: 10px;
width: 100%;
} }
#search-box { #search-box {
@ -195,6 +213,8 @@ body {
box-sizing: border-box; box-sizing: border-box;
position: relative; position: relative;
height: 33px; height: 33px;
min-height: 33px;
width: 100%;
background: var(--main-background-color); background: var(--main-background-color);
border-radius: 5px 5px 0 0; border-radius: 5px 5px 0 0;
overflow: hidden; overflow: hidden;
@ -240,8 +260,14 @@ body {
} }
.tab-row-filler { .tab-row-filler {
-webkit-app-region: drag;
position: absolute; position: absolute;
left: 0; left: 0;
height: 33px;
}
.tab-row-filler .tab-row-border {
position: relative;
background: linear-gradient(to right, var(--main-border-color), transparent); background: linear-gradient(to right, var(--main-border-color), transparent);
height: 1px; height: 1px;
margin-top: 32px; margin-top: 32px;

View File

@ -11,44 +11,9 @@
<div id="toast-container" class="d-flex flex-column justify-content-center align-items-center"></div> <div id="toast-container" class="d-flex flex-column justify-content-center align-items-center"></div>
<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: minmax(<%= leftPaneMinWidth %>px, <%= leftPaneWidthPercent %>fr) minmax(0, <%= rightPaneWidthPercent %>fr)">
<div id="header" class="hide-in-zen-mode"> <div style="display: flex;">
<div id="history-navigation" style="display: none;"> <div class="note-tab-row hide-in-zen-mode">
<a id="history-back-button" title="Go to previous note." class="icon-action bx bx-left-arrow-circle"></a> <div class="note-tab-row-content"></div>
<a id="history-forward-button" title="Go to next note." class="icon-action bx bx-right-arrow-circle"></a>
</div>
<div style="flex-grow: 100; display: flex;">
<button class="btn btn-sm" id="jump-to-note-dialog-button" data-kb-action="JumpToNote">
<span class="bx bx-crosshair"></span>
Jump to note
</button>
<button class="btn btn-sm" id="recent-changes-button" data-kb-action="ShowRecentChanges">
<span class="bx bx-history"></span>
Recent changes
</button>
<button class="btn btn-sm"
id="enter-protected-session-button"
title="Enter protected session to be able to find and view protected notes">
<span class="bx bx-log-in"></span>
Enter protected session
</button>
<button class="btn btn-sm"
id="leave-protected-session-button"
title="Leave protected session so that protected notes are not accessible any more."
style="display: none;">
<span class="bx bx-log-out"></span>
Leave protected session
</button>
</div>
<div id="plugin-buttons">
</div> </div>
<div> <div>
@ -125,6 +90,47 @@
</div> </div>
</div> </div>
<div id="header" class="hide-in-zen-mode">
<div id="history-navigation" style="display: none;">
<a id="history-back-button" title="Go to previous note." class="icon-action bx bx-left-arrow-circle"></a>
<a id="history-forward-button" title="Go to next note." class="icon-action bx bx-right-arrow-circle"></a>
</div>
<div style="flex-grow: 100; display: flex;">
<button class="btn btn-sm" id="jump-to-note-dialog-button" data-kb-action="JumpToNote">
<span class="bx bx-crosshair"></span>
Jump to note
</button>
<button class="btn btn-sm" id="recent-changes-button" data-kb-action="ShowRecentChanges">
<span class="bx bx-history"></span>
Recent changes
</button>
<button class="btn btn-sm"
id="enter-protected-session-button"
title="Enter protected session to be able to find and view protected notes">
<span class="bx bx-log-in"></span>
Enter protected session
</button>
<button class="btn btn-sm"
id="leave-protected-session-button"
title="Leave protected session so that protected notes are not accessible any more."
style="display: none;">
<span class="bx bx-log-out"></span>
Leave protected session
</button>
</div>
<div id="plugin-buttons">
</div>
</div>
<div style="display: flex; height: 100%;"> <div style="display: flex; height: 100%;">
<div id="left-pane" class="hide-in-zen-mode"> <div id="left-pane" class="hide-in-zen-mode">
<div id="global-buttons"> <div id="global-buttons">
@ -232,6 +238,8 @@
<script src="libraries/dayjs.min.js"></script> <script src="libraries/dayjs.min.js"></script>
<script src="libraries/split.min.js"></script>
<link href="stylesheets/themes.css" rel="stylesheet"> <link href="stylesheets/themes.css" rel="stylesheet">
<link href="stylesheets/style.css" rel="stylesheet"> <link href="stylesheets/style.css" rel="stylesheet">
<link href="stylesheets/desktop.css" rel="stylesheet"> <link href="stylesheets/desktop.css" rel="stylesheet">

View File

@ -1,7 +1,3 @@
<div class="note-tab-row hide-in-zen-mode">
<div class="note-tab-row-content"></div>
</div>
<div id="note-tab-container"> <div id="note-tab-container">
<div class="note-tab-content note-tab-content-template"> <div class="note-tab-content note-tab-content-template">
<div class="note-detail-content" style="width: <%= contentWidthPercent %>%"> <div class="note-detail-content" style="width: <%= contentWidthPercent %>%">