diff --git a/src/public/app/widgets/note_tree.js b/src/public/app/widgets/note_tree.js
index 082ca86ec..e2cee7c4f 100644
--- a/src/public/app/widgets/note_tree.js
+++ b/src/public/app/widgets/note_tree.js
@@ -176,6 +176,15 @@ const TPL = `
title="Images which are shown in the parent text note will not be displayed in the tree">
+
+
+
@@ -235,6 +244,7 @@ export default class NoteTreeWidget extends TabAwareWidget {
this.$treeSettingsPopup = this.$widget.find('.tree-settings-popup');
this.$hideArchivedNotesCheckbox = this.$treeSettingsPopup.find('.hide-archived-notes');
this.$hideIncludedImages = this.$treeSettingsPopup.find('.hide-included-images');
+ this.$autoCollapseNoteTree = this.$treeSettingsPopup.find('.auto-collapse-note-tree');
this.$treeSettingsButton = this.$widget.find('.tree-settings-button');
this.$treeSettingsButton.on("click", e => {
@@ -245,6 +255,7 @@ export default class NoteTreeWidget extends TabAwareWidget {
this.$hideArchivedNotesCheckbox.prop("checked", this.hideArchivedNotes);
this.$hideIncludedImages.prop("checked", this.hideIncludedImages);
+ this.$autoCollapseNoteTree.prop("checked", this.autoCollapseNoteTree);
let top = this.$treeSettingsButton[0].offsetTop;
let left = this.$treeSettingsButton[0].offsetLeft;
@@ -272,6 +283,7 @@ export default class NoteTreeWidget extends TabAwareWidget {
this.$saveTreeSettingsButton.on('click', async () => {
await this.setHideArchivedNotes(this.$hideArchivedNotesCheckbox.prop("checked"));
await this.setHideIncludedImages(this.$hideIncludedImages.prop("checked"));
+ await this.setAutoCollapseNoteTree(this.$autoCollapseNoteTree.prop("checked"));
this.$treeSettingsPopup.hide();
@@ -327,6 +339,14 @@ export default class NoteTreeWidget extends TabAwareWidget {
await options.save("hideIncludedImages_" + this.treeName, val.toString());
}
+ get autoCollapseNoteTree() {
+ return options.is("autoCollapseNoteTree");
+ }
+
+ async setAutoCollapseNoteTree(val) {
+ await options.save("autoCollapseNoteTree", val.toString());
+ }
+
initFancyTree() {
const treeData = [this.prepareRootNode()];
@@ -961,6 +981,10 @@ export default class NoteTreeWidget extends TabAwareWidget {
}
this.autoCollapseTimeoutId = setTimeout(() => {
+ if (!this.autoCollapseNoteTree) {
+ return;
+ }
+
/*
* We're collapsing notes after period of inactivity to "cleanup" the tree - users rarely
* collapse the notes and the tree becomes unusuably large.
diff --git a/src/routes/api/options.js b/src/routes/api/options.js
index d08581037..4928adcce 100644
--- a/src/routes/api/options.js
+++ b/src/routes/api/options.js
@@ -41,7 +41,8 @@ const ALLOWED_OPTIONS = new Set([
'attributeListExpanded',
'promotedAttributesExpanded',
'similarNotesExpanded',
- 'headingStyle'
+ 'headingStyle',
+ 'autoCollapseNoteTree'
]);
function getOptions() {
diff --git a/src/services/options_init.js b/src/services/options_init.js
index 35b2768de..81ac7b53c 100644
--- a/src/services/options_init.js
+++ b/src/services/options_init.js
@@ -86,6 +86,7 @@ const defaultOptions = [
{ name: 'similarNotesExpanded', value: 'true', isSynced: true },
{ name: 'debugModeEnabled', value: 'false', isSynced: false },
{ name: 'headingStyle', value: 'markdown', isSynced: true },
+ { name: 'autoCollapseNoteTree', value: 'true', isSynced: true },
];
function initStartupOptions() {