Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
fix displaying hidden notes in the note's children list #2664
zadamf7e5d8f62d62
diff --git a/src/share/shaca/entities/note.js b/src/share/shaca/entities/note.jsindex f66ce27fbe..ac7377f88d 100644--- a/src/share/shaca/entities/note.js+++ b/src/share/shaca/entities/note.js@@ -58,10 +58,20 @@ class Note extends AbstractEntity {return this.children;}+ getVisibleChildNotes() {+ console.log(this.children.filter(childNote => !childNote.hasLabel('shareHiddenFromTree')));++ return this.children.filter(childNote => !childNote.hasLabel('shareHiddenFromTree'));+ }+hasChildren() {return this.children && this.children.length > 0;}+ hasVisibleChildren() {+ return this.children && !!this.children.find(childNote => !childNote.hasLabel('shareHiddenFromTree'));+ }+getChildBranches() {return this.children.map(childNote => this.shaca.getBranchFromChildAndParent(childNote.noteId, this.noteId));}diff --git a/src/views/share/page.ejs b/src/views/share/page.ejsindex b7506b853e..ed52d218b8 100644--- a/src/views/share/page.ejs+++ b/src/views/share/page.ejs@@ -46,7 +46,7 @@</div><% } %>- <% if (note.hasChildren()) { %>+ <% if (note.hasVisibleChildren()) { %><nav id="childLinks" class="<% if (isEmpty) { %>grid<% } else { %>list<% } %>"><% if (!isEmpty) { %><hr>@@ -54,7 +54,7 @@<% } %><ul>- <% for (const childNote of note.getChildNotes()) { %>+ <% for (const childNote of note.getVisibleChildNotes()) { %><li><a href="<%= childNote.shareId %>"class="type-<%= childNote.type %>"><%= childNote.title %></a>@@ -67,7 +67,7 @@<% } %></div>- <% if (subRoot.hasChildren()) { %>+ <% if (subRoot.hasVisibleChildren()) { %><button id="toggleMenuButton"></button><nav id="menu">