mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
add option to disable note tree auto collapse, fixes #1751
This commit is contained in:
parent
0cfd95d9b8
commit
e8903e82a1
@ -176,6 +176,15 @@ const TPL = `
|
|||||||
title="Images which are shown in the parent text note will not be displayed in the tree"></span>
|
title="Images which are shown in the parent text note will not be displayed in the tree"></span>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-check">
|
||||||
|
<label class="form-check-label">
|
||||||
|
<input class="form-check-input auto-collapse-note-tree" type="checkbox" value="">
|
||||||
|
|
||||||
|
Automatically collapse notes
|
||||||
|
<span class="bx bx-info-circle"
|
||||||
|
title="Notes will be collapsed after period of inactivity to declutter the tree."></span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
<br/>
|
<br/>
|
||||||
|
|
||||||
@ -235,6 +244,7 @@ export default class NoteTreeWidget extends TabAwareWidget {
|
|||||||
this.$treeSettingsPopup = this.$widget.find('.tree-settings-popup');
|
this.$treeSettingsPopup = this.$widget.find('.tree-settings-popup');
|
||||||
this.$hideArchivedNotesCheckbox = this.$treeSettingsPopup.find('.hide-archived-notes');
|
this.$hideArchivedNotesCheckbox = this.$treeSettingsPopup.find('.hide-archived-notes');
|
||||||
this.$hideIncludedImages = this.$treeSettingsPopup.find('.hide-included-images');
|
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 = this.$widget.find('.tree-settings-button');
|
||||||
this.$treeSettingsButton.on("click", e => {
|
this.$treeSettingsButton.on("click", e => {
|
||||||
@ -245,6 +255,7 @@ export default class NoteTreeWidget extends TabAwareWidget {
|
|||||||
|
|
||||||
this.$hideArchivedNotesCheckbox.prop("checked", this.hideArchivedNotes);
|
this.$hideArchivedNotesCheckbox.prop("checked", this.hideArchivedNotes);
|
||||||
this.$hideIncludedImages.prop("checked", this.hideIncludedImages);
|
this.$hideIncludedImages.prop("checked", this.hideIncludedImages);
|
||||||
|
this.$autoCollapseNoteTree.prop("checked", this.autoCollapseNoteTree);
|
||||||
|
|
||||||
let top = this.$treeSettingsButton[0].offsetTop;
|
let top = this.$treeSettingsButton[0].offsetTop;
|
||||||
let left = this.$treeSettingsButton[0].offsetLeft;
|
let left = this.$treeSettingsButton[0].offsetLeft;
|
||||||
@ -272,6 +283,7 @@ export default class NoteTreeWidget extends TabAwareWidget {
|
|||||||
this.$saveTreeSettingsButton.on('click', async () => {
|
this.$saveTreeSettingsButton.on('click', async () => {
|
||||||
await this.setHideArchivedNotes(this.$hideArchivedNotesCheckbox.prop("checked"));
|
await this.setHideArchivedNotes(this.$hideArchivedNotesCheckbox.prop("checked"));
|
||||||
await this.setHideIncludedImages(this.$hideIncludedImages.prop("checked"));
|
await this.setHideIncludedImages(this.$hideIncludedImages.prop("checked"));
|
||||||
|
await this.setAutoCollapseNoteTree(this.$autoCollapseNoteTree.prop("checked"));
|
||||||
|
|
||||||
this.$treeSettingsPopup.hide();
|
this.$treeSettingsPopup.hide();
|
||||||
|
|
||||||
@ -327,6 +339,14 @@ export default class NoteTreeWidget extends TabAwareWidget {
|
|||||||
await options.save("hideIncludedImages_" + this.treeName, val.toString());
|
await options.save("hideIncludedImages_" + this.treeName, val.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get autoCollapseNoteTree() {
|
||||||
|
return options.is("autoCollapseNoteTree");
|
||||||
|
}
|
||||||
|
|
||||||
|
async setAutoCollapseNoteTree(val) {
|
||||||
|
await options.save("autoCollapseNoteTree", val.toString());
|
||||||
|
}
|
||||||
|
|
||||||
initFancyTree() {
|
initFancyTree() {
|
||||||
const treeData = [this.prepareRootNode()];
|
const treeData = [this.prepareRootNode()];
|
||||||
|
|
||||||
@ -961,6 +981,10 @@ export default class NoteTreeWidget extends TabAwareWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.autoCollapseTimeoutId = setTimeout(() => {
|
this.autoCollapseTimeoutId = setTimeout(() => {
|
||||||
|
if (!this.autoCollapseNoteTree) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We're collapsing notes after period of inactivity to "cleanup" the tree - users rarely
|
* We're collapsing notes after period of inactivity to "cleanup" the tree - users rarely
|
||||||
* collapse the notes and the tree becomes unusuably large.
|
* collapse the notes and the tree becomes unusuably large.
|
||||||
|
@ -41,7 +41,8 @@ const ALLOWED_OPTIONS = new Set([
|
|||||||
'attributeListExpanded',
|
'attributeListExpanded',
|
||||||
'promotedAttributesExpanded',
|
'promotedAttributesExpanded',
|
||||||
'similarNotesExpanded',
|
'similarNotesExpanded',
|
||||||
'headingStyle'
|
'headingStyle',
|
||||||
|
'autoCollapseNoteTree'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
function getOptions() {
|
function getOptions() {
|
||||||
|
@ -86,6 +86,7 @@ const defaultOptions = [
|
|||||||
{ name: 'similarNotesExpanded', value: 'true', isSynced: true },
|
{ name: 'similarNotesExpanded', value: 'true', isSynced: true },
|
||||||
{ name: 'debugModeEnabled', value: 'false', isSynced: false },
|
{ name: 'debugModeEnabled', value: 'false', isSynced: false },
|
||||||
{ name: 'headingStyle', value: 'markdown', isSynced: true },
|
{ name: 'headingStyle', value: 'markdown', isSynced: true },
|
||||||
|
{ name: 'autoCollapseNoteTree', value: 'true', isSynced: true },
|
||||||
];
|
];
|
||||||
|
|
||||||
function initStartupOptions() {
|
function initStartupOptions() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user