mirror of
https://github.com/zadam/trilium.git
synced 2025-11-15 09:45:52 +01:00
Allow external link notes in share tree
This commit is contained in:
@@ -32,7 +32,7 @@
|
||||
<%- header %>
|
||||
<title><%= note.title %></title>
|
||||
</head>
|
||||
<body data-note-id="<%= note.noteId %>">
|
||||
<body data-note-id="<%= note.noteId %>" data-wtf="true">
|
||||
<div id="layout">
|
||||
<div id="main">
|
||||
<% if (note.parents[0].noteId !== '_share' && note.parents.length !== 0) { %>
|
||||
@@ -62,9 +62,14 @@
|
||||
<% } %>
|
||||
|
||||
<ul>
|
||||
<% for (const childNote of note.getVisibleChildNotes()) { %>
|
||||
<%
|
||||
for (const childNote of note.getVisibleChildNotes()) {
|
||||
const isExternalLink = childNote.hasLabel('shareExternalLink');
|
||||
const linkHref = isExternalLink ? childNote.getLabelValue('shareExternalLink') : `./${childNote.shareId}`;
|
||||
const target = isExternalLink ? `target="_blank" rel="noopener noreferrer"` : '';
|
||||
%>
|
||||
<li>
|
||||
<a href="<%= childNote.shareId %>"
|
||||
<a href="<%= linkHref %>" <%= target %>
|
||||
class="type-<%= childNote.type %>"><%= childNote.title %></a>
|
||||
</li>
|
||||
<% } %>
|
||||
|
||||
@@ -1,10 +1,16 @@
|
||||
<%
|
||||
const isExternalLink = note.hasLabel('shareExternalLink');
|
||||
const linkHref = isExternalLink ? note.getLabelValue('shareExternalLink') : `./${note.shareId}`;
|
||||
const target = isExternalLink ? ` target="_blank" rel="noopener noreferrer"` : '';
|
||||
console.log(note.shareId, note.title, isExternalLink, linkHref, target);
|
||||
%>
|
||||
<p>
|
||||
<% const titleWithPrefix = (branch.prefix ? `${branch.prefix} - ` : '') + note.title; %>
|
||||
|
||||
<% if (activeNote.noteId === note.noteId) { %>
|
||||
<strong><%= titleWithPrefix %></strong>
|
||||
<% } else { %>
|
||||
<a class="type-<%= note.type %>" href="./<%= note.shareId %>"><%= titleWithPrefix %></a>
|
||||
<a class="type-<%= note.type %>" href="<%= linkHref %>"<%= target %>><%= titleWithPrefix %></a>
|
||||
<% } %>
|
||||
</p>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user