Files
Trilium/src/views/share/tree_item.ejs

25 lines
817 B
Plaintext
Raw Normal View History

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