Skip to content

Build your personal knowledge base with Trilium Notes

sharing fixes

zadam5ecb603e86f1
diff --git a/src/public/app/share.js b/src/public/app/share.js
index e7785ba7a5..2f2621e2a1 100644
--- a/src/public/app/share.js
+++ b/src/public/app/share.js
@@ -5,10 +5,10 @@
*/
async function fetchNote(noteId = null) {
if (!noteId) {
- noteId = document.getElementsByName("body")[0].getAttribute("data-note-id");
+ noteId = document.body.getAttribute("data-note-id");
}
- const resp = await fetch(`share/api/notes/${noteId}`);
+ const resp = await fetch(`api/notes/${noteId}`);
return await resp.json();
}
diff --git a/src/views/share/page.ejs b/src/views/share/page.ejs
index c889bd7f31..0f1ccaa1ba 100644
--- a/src/views/share/page.ejs
+++ b/src/views/share/page.ejs
@@ -7,7 +7,7 @@
<% } else { %>
<link rel="shortcut icon" href="../favicon.ico">
<% } %>
- <script src="app/share.js"></script>
+ <script src="../app/share.js"></script>
<% if (!note.hasLabel("shareOmitDefaultCss")) { %>
<link href="../libraries/normalize.min.css" rel="stylesheet">
<link href="../stylesheets/share.css" rel="stylesheet">
@@ -19,7 +19,7 @@
<link href="api/notes/<%= cssRelation.value %>/download" rel="stylesheet">
<% } %>
<% for (const jsRelation of note.getRelations("shareJs")) { %>
- <script src="api/notes/<%= jsRelation.value %>/download"></script>
+ <script type="module" src="api/notes/<%= jsRelation.value %>/download"></script>
<% } %>
<%- header %>
<title><%= note.title %></title>