Files
Trilium/src/views/share/tree_item.ejs
2023-10-08 14:54:37 -04:00

25 lines
817 B
Plaintext

<%
const isExternalLink = note.hasLabel('shareExternalLink');
const linkHref = isExternalLink ? note.getLabelValue('shareExternalLink') : `./${note.shareId}`;
const target = isExternalLink ? ` target="_blank" rel="noopener noreferrer"` : '';
%>
<p>
<% const titleWithPrefix = (branch.prefix ? `${branch.prefix} - ` : '') + note.title; %>
<% if (activeNote.noteId === note.noteId) { %>
<strong><%= titleWithPrefix %></strong>
<% } else { %>
<a class="type-<%= note.type %>" href="<%= linkHref %>"<%= target %>><%= titleWithPrefix %></a>
<% } %>
</p>
<% if (note.hasChildren()) { %>
<ul>
<% note.getVisibleChildBranches().forEach(function (branch) { %>
<li>
<%- include('tree_item', {branch: branch, note: branch.getNote()}) %>
</li>
<% }) %>
</ul>
<% } %>