Skip to content

Build your personal knowledge base with Trilium Notes

fix setting the title bar when switching note

zadam8d3262d2321e
diff --git a/src/public/javascripts/services/note_detail_relation_map.js b/src/public/javascripts/services/note_detail_relation_map.js
index 9a36a22108..3220466bed 100644
--- a/src/public/javascripts/services/note_detail_relation_map.js
+++ b/src/public/javascripts/services/note_detail_relation_map.js
@@ -553,7 +553,13 @@ class NoteDetailRelationMap {
getZoom() {
const matrixRegex = /matrix\((-?\d*\.?\d+),\s*0,\s*0,\s*-?\d*\.?\d+,\s*-?\d*\.?\d+,\s*-?\d*\.?\d+\)/;
- const matches = this.$relationMapContainer.css('transform').match(matrixRegex);
+ const transform = this.$relationMapContainer.css('transform');
+
+ const matches = transform.match(matrixRegex);
+
+ if (!matches) {
+ throw new Error("Cannot match transform: " + transform);
+ }
return matches[1];
}
diff --git a/src/public/javascripts/services/tab_context.js b/src/public/javascripts/services/tab_context.js
index 51ee4cf1f4..4becfb2648 100644
--- a/src/public/javascripts/services/tab_context.js
+++ b/src/public/javascripts/services/tab_context.js
@@ -101,6 +101,8 @@ class TabContext {
this.setCurrentNotePathToHash();
+ this.setTitleBar();
+
setTimeout(async () => {
// we include the note into recent list only if the user stayed on the note at least 5 seconds
if (notePath && notePath === this.notePath) {
@@ -123,6 +125,13 @@ class TabContext {
show() {
this.$tabContent.show();
this.setCurrentNotePathToHash();
+ this.setTitleBar();
+ }
+
+ setTitleBar() {
+ if (!this.$tabContent.is(":visible")) {
+ return;
+ }
document.title = "Trilium Notes";