Skip to content

Build your personal knowledge base with Trilium Notes

ability to set book zoom level via label

zadamea71e96f7273
diff --git a/src/public/javascripts/services/note_detail_book.js b/src/public/javascripts/services/note_detail_book.js
index b1952e21c1..aa18002fb8 100644
--- a/src/public/javascripts/services/note_detail_book.js
+++ b/src/public/javascripts/services/note_detail_book.js
@@ -3,6 +3,7 @@ import linkService from "./link.js";
import utils from "./utils.js";
import treeCache from "./tree_cache.js";
import renderService from "./render.js";
+import zoom from "./zoom.js";
const MIN_ZOOM_LEVEL = 1;
const MAX_ZOOM_LEVEL = 6;
@@ -45,7 +46,6 @@ class NoteDetailBook {
this.$zoomInButton = this.$component.find('.book-zoom-in-button');
this.$zoomOutButton = this.$component.find('.book-zoom-out-button');
this.$expandChildrenButton = this.$component.find('.expand-children-button');
- this.setZoom(1);
this.$zoomInButton.click(() => this.setZoom(this.zoomLevel - 1));
this.$zoomOutButton.click(() => this.setZoom(this.zoomLevel + 1));
@@ -93,6 +93,10 @@ class NoteDetailBook {
}
setZoom(zoomLevel) {
+ if (!(zoomLevel in ZOOMS)) {
+ zoomLevel = 1;
+ }
+
this.zoomLevel = zoomLevel;
this.$zoomInButton.prop("disabled", zoomLevel === MIN_ZOOM_LEVEL);
@@ -105,6 +109,9 @@ class NoteDetailBook {
async render() {
this.$content.empty();
+ const zoomLevel = parseInt(await this.ctx.note.getLabelValue('bookZoomLevel')) || 1;
+ this.setZoom(zoomLevel);
+
await this.renderIntoElement(this.ctx.note, this.$content);
}
diff --git a/src/public/stylesheets/link_map.css b/src/public/stylesheets/link_map.css
index 020672d210..7ccdfd38d8 100644
--- a/src/public/stylesheets/link_map.css
+++ b/src/public/stylesheets/link_map.css
@@ -31,11 +31,6 @@
font-weight: 600;
}
-.link-map-container .floating-button {
- position: absolute !important;
- z-index: 100;
-}
-
.link-map-active-note {
background-color: var(--accented-background-color) !important;
}
diff --git a/src/public/stylesheets/style.css b/src/public/stylesheets/style.css
index 4ad5cd91f7..3f07af9369 100644
--- a/src/public/stylesheets/style.css
+++ b/src/public/stylesheets/style.css
@@ -824,10 +824,15 @@ a.external:not(.no-arrow):after, a[href^="http://"]:not(.no-arrow):after, a[href
z-index: 100;
}
+.note-detail-book {
+ height: 100%;
+}
+
.note-detail-book-content {
display: flex;
flex-wrap: wrap;
overflow: auto;
+ height: 100%;
align-content: start;
}
diff --git a/src/views/details/book.ejs b/src/views/details/book.ejs
index eb0d2cc8ee..f5dee5d76d 100644
--- a/src/views/details/book.ejs
+++ b/src/views/details/book.ejs
@@ -1,5 +1,5 @@
<div class="note-detail-book note-detail-component">
- <div class="btn-group floating-button" style="right: 10px; top: 20px;">
+ <div class="btn-group floating-button" style="right: 20px; top: 20px;">
<button type="button"
class="expand-children-button btn icon-button jam jam-arrows-v"
title="Expand all children"></button>