Skip to content

Build your personal knowledge base with Trilium Notes

layout conversion to cleaner CSS grid, work in progress

azivner21f49ea7c5ea
diff --git a/src/templates/app.html b/src/templates/app.html
index 83aa89f310..497e25b177 100644
--- a/src/templates/app.html
+++ b/src/templates/app.html
@@ -5,85 +5,86 @@
<title>Notecase web app</title>
</head>
<body>
- <div id="top" style="text-align: center;">
- &nbsp;
+ <div id="top" style="grid-area: messages; text-align: center;">&nbsp;
<span id="top-message"></span>
<span id="error-message"></span>
</div>
- <div id="content" style="margin-left: auto; margin-right: auto; width: 1100px; position: relative;">
- <div style="position: absolute; left: 1020px;" class="hide-toggle">
- <form action="logout" method="POST">
- <input type="submit" class="btn btn-sm" value="Logout">
- </form>
- </div>
+ <div class="hide-toggle" style="grid-area: search">
+ <p>
+ <label>Search:</label>
+ <input name="search" autocomplete="off">
+ <button id="btnResetSearch">&times;</button>
+ <span id="matches"></span>
+ </p>
+ </div>
- <div class="hide-toggle" style="position: absolute; left: 940px;">
- <button class="btn btn-sm" onclick="displaySettings();">Settings</button>
- </div>
+ <div class="hide-toggle" style="grid-area: tree-buttons;">
+ <a onclick="createNewTopLevelNote()" title="Create new top level note" class="icon-action">
+ <img src="stat/icons/file-plus.png" alt="Create new top level note"/>
+ </a>
- <div class="hide-toggle" style="width: 300px; height: 100%; float: left;">
- <p>
- <label>Search:</label>
- <input name="search" autocomplete="off">
- <button id="btnResetSearch">&times;</button>
- <span id="matches"></span>
- </p>
+ <a onclick="collapseTree()" title="Collapse tree" class="icon-action">
+ <img src="stat/icons/list.png" alt="Collapse tree"/>
+ </a>
- <a onclick="createNewTopLevelNote()" title="Create new top level note" class="icon-action">
- <img src="stat/icons/file-plus.png" alt="Create new top level note"/>
- </a>
+ <a onclick="scrollToCurrentNote()" title="Scroll to current note" class="icon-action">
+ <img src="stat/icons/crosshair.png" alt="Collapse tree"/>
+ </a>
+ </div>
- <a onclick="collapseTree()" title="Collapse tree" class="icon-action">
- <img src="stat/icons/list.png" alt="Collapse tree"/>
+ <div id="tree" style="overflow: auto; grid-area: tree">
+ </div>
+
+ <div style="grid-area: title">
+ <div style="display: flex; align-items: center;" class="hide-toggle">
+ <a onclick="encryptNoteAndSendToServer()"
+ title="Encrypt the note so that password will be required to view the note"
+ class="icon-action"
+ id="encryptButton"
+ style="display: none;">
+ <img src="stat/icons/lock.png" alt="Encrypt note"/>
</a>
- <a onclick="scrollToCurrentNote()" title="Scroll to current note" class="icon-action">
- <img src="stat/icons/crosshair.png" alt="Collapse tree"/>
+ <a onclick="decryptNoteAndSendToServer()"
+ title="Decrypt note permamently so that password will not be required to access this note in the future"
+ class="icon-action"
+ id="decryptButton"
+ style="display: none;">
+ <img src="stat/icons/unlock.png" alt="Decrypt note"/>
</a>
- <div id="tree">
- </div>
- </div>
+ &nbsp;
- <div id="noteDetailWrapper">
- <div style="float: left; margin: 0 5px 5px 5px;" class="hide-toggle">
- <a onclick="encryptNoteAndSendToServer()"
- title="Encrypt the note so that password will be required to view the note"
- class="icon-action"
- id="encryptButton">
- <img src="stat/icons/lock.png" alt="Encrypt note"/>
- </a>
-
- <a onclick="decryptNoteAndSendToServer()"
- title="Decrypt note permamently so that password will not be required to access this note in the future"
- class="icon-action"
- id="decryptButton">
- <img src="stat/icons/unlock.png" alt="Decrypt note"/>
- </a>
-
- &nbsp;
-
- <input autocomplete="off" value="Welcome to Notecase web app!" id="noteTitle" style="font-size: x-large; border: 0; width: 600px;" tabindex="1">
+ <input autocomplete="off" value="Welcome to Notecase web app!" id="noteTitle" style="font-size: x-large; border: 0; flex-grow: 100;" tabindex="1">
+
+ <div class="hide-toggle">
+ <form action="logout" method="POST">
+ <input type="submit" class="btn btn-sm" value="Logout">
+ </form>
</div>
- <div style="clear: both; height: 0"></div>
+ <div class="hide-toggle">
+ <button class="btn btn-sm" onclick="displaySettings();">Settings</button>
+ </div>
+ </div>
+ </div>
- <div id="noteDetail" style="overflow: scroll; height: 100%;">
- <p>This prototype version supports basic editing, including some formatting (bold, italic, strike-through, underscore), images (just paste it into editor) and links. To edit the note, just click on title or content and you can directly modify it. Changes are saved immediately.</p>
+ <div style="overflow: auto; grid-area: note-content">
+ <div id="noteDetail">
+ <p>This prototype version supports basic editing, including some formatting (bold, italic, strike-through, underscore), images (just paste it into editor) and links. To edit the note, just click on title or content and you can directly modify it. Changes are saved immediately.</p>
- <p>You can work with the tree using following keyboard shortcuts:</p>
+ <p>You can work with the tree using following keyboard shortcuts:</p>
- <ul>
- <li>insert - create new note on current tree level</li>
- <li>ctrl + insert - create new sub-note</li>
- <li>delete - delete current note (and it's sub-notes)</li>
- <li>shift + up - move current note up in the current tree level</li>
- <li>shift + down - move current note down in the current tree level</li>
- <li>shift + left - move current note up in the tree hierarchy</li>
- <li>shift + right - move current note down in the tree hierarchy</li>
- </ul>
- </div>
+ <ul>
+ <li>insert - create new note on current tree level</li>
+ <li>ctrl + insert - create new sub-note</li>
+ <li>delete - delete current note (and it's sub-notes)</li>
+ <li>shift + up - move current note up in the current tree level</li>
+ <li>shift + down - move current note down in the current tree level</li>
+ <li>shift + left - move current note up in the tree hierarchy</li>
+ <li>shift + right - move current note down in the tree hierarchy</li>
+ </ul>
</div>
</div>
diff --git a/static/js/init.js b/static/js/init.js
index 0338643ae3..fbdf7d59f9 100644
--- a/static/js/init.js
+++ b/static/js/init.js
@@ -1,21 +1,3 @@
-$(function() {
- $(window).resize(function() {
- // dynamically setting height of tree and note content to match window's height
- const fancyTree = $('ul.fancytree-container');
-
- if (fancyTree.length) {
- fancyTree.height($(window).height() - fancyTree.offset().top - 10);
- }
-
- const noteEditable = $('div.note-editable');
-
- if (noteEditable.length) {
- noteEditable.height($(window).height() - noteEditable.offset().top);
- }
- });
- $(window).resize();
-});
-
// hot keys are active also inside inputs and content editables
jQuery.hotkeys.options.filterInputAcceptingElements = true;
jQuery.hotkeys.options.filterContentEditable = true;
diff --git a/static/style.css b/static/style.css
index 18b3eae7ab..ff09cc3ba5 100644
--- a/static/style.css
+++ b/static/style.css
@@ -1,19 +1,13 @@
.note-editable {
/* This is because with empty content height of editor is 0 and it's impossible to click into it */
min-height: 400px;
- overflow: scroll;
+ overflow: auto;
}
.note-editable.encrypted {
background-color: #eee;
}
-#noteDetailWrapper {
- width: 750px;
- float: left;
- margin-left: 30px;
-}
-
#top-message {
display: none; /* initial state is hidden */
background-color: #e0e0e0;
@@ -36,8 +30,6 @@
}
ul.fancytree-container {
- width: 290px;
- height: 400px;
overflow: auto;
position: relative;
outline: none !important;
@@ -82,4 +74,19 @@ span.fancytree-node.encrypted.fancytree-folder > span.fancytree-icon {
#encryptButton img, #decryptButton img {
top: -5px;
position: relative;
+}
+
+body {
+ display: grid;
+ height: 100vh;
+ grid-template-areas: "messages messages"
+ "search title"
+ "tree-buttons note-content"
+ "tree note-content";
+ grid-template-columns: 1fr 3fr;
+ grid-template-rows: auto
+ auto
+ auto
+ 1fr;
+ grid-gap: 10px;
}
\ No newline at end of file