note paths widget does not show hidden path

This commit is contained in:
zadam 2021-06-06 11:13:17 +02:00
parent c886583396
commit a0de3c97a5
3 changed files with 18 additions and 4 deletions

View file

@ -300,7 +300,8 @@ class NoteShort {
notePath: path, notePath: path,
isInHoistedSubTree: path.includes(hoistedNotePath), isInHoistedSubTree: path.includes(hoistedNotePath),
isArchived: path.find(noteId => froca.notes[noteId].hasLabel('archived')), isArchived: path.find(noteId => froca.notes[noteId].hasLabel('archived')),
isSearch: path.find(noteId => froca.notes[noteId].type === 'search') isSearch: path.find(noteId => froca.notes[noteId].type === 'search'),
isHidden: path.includes("hidden")
})); }));
notePaths.sort((a, b) => { notePaths.sort((a, b) => {

View file

@ -28,7 +28,7 @@ const TPL = `
} }
</style> </style>
<div>This note is placed into the following paths:</div> <div class="note-path-intro"></div>
<ul class="note-path-list"></ul> <ul class="note-path-list"></ul>
@ -51,6 +51,7 @@ export default class NotePathsWidget extends NoteContextAwareWidget {
doRender() { doRender() {
this.$widget = $(TPL); this.$widget = $(TPL);
this.$notePathIntro = this.$widget.find(".note-path-intro");
this.$notePathList = this.$widget.find(".note-path-list"); this.$notePathList = this.$widget.find(".note-path-list");
this.$widget.on('show.bs.dropdown', () => this.renderDropdown()); this.$widget.on('show.bs.dropdown', () => this.renderDropdown());
} }
@ -63,7 +64,17 @@ export default class NotePathsWidget extends NoteContextAwareWidget {
return; return;
} }
for (const notePathRecord of this.note.getSortedNotePaths(this.hoistedNoteId)) { const sortedNotePaths = this.note.getSortedNotePaths(this.hoistedNoteId)
.filter(notePath => !notePath.isHidden);
if (sortedNotePaths.length > 0) {
this.$notePathIntro.text("This note is placed into the following paths:");
}
else {
this.$notePathIntro.text("This note is not yet placed into the note tree.");
}
for (const notePathRecord of sortedNotePaths) {
await this.addPath(notePathRecord); await this.addPath(notePathRecord);
} }
} }

View file

@ -92,7 +92,9 @@ function getHiddenRoot() {
parentNoteId: 'root' parentNoteId: 'root'
}).note; }).note;
hidden.addLabel('archived', "", true); // isInheritable: false means that this notePath is automatically not preffered but at the same time
// the flag is not inherited to the children
hidden.addLabel('archived', "", false);
} }
return hidden; return hidden;