Skip to content

Build your personal knowledge base with Trilium Notes

feat(note_tooltip): clickable note title (closes #1063)

Elian Doran0dbd136b483c
diff --git a/src/public/app/services/link.ts b/src/public/app/services/link.ts
index f80a3c10ad..da049d52fd 100644
--- a/src/public/app/services/link.ts
+++ b/src/public/app/services/link.ts
@@ -361,6 +361,10 @@ function linkContextMenu(e: PointerEvent) {
const $link = $(e.target as any).closest("a");
const url = $link.attr("href") || $link.attr("data-href");
+ if ($link.attr("data-no-context-menu")) {
+ return;
+ }
+
const { notePath, viewScope } = parseNavigationStateFromUrl(url);
if (!notePath) {
diff --git a/src/public/app/services/note_tooltip.ts b/src/public/app/services/note_tooltip.ts
index 39db16bd0e..28937f3e21 100644
--- a/src/public/app/services/note_tooltip.ts
+++ b/src/public/app/services/note_tooltip.ts
@@ -155,7 +155,7 @@ async function renderTooltip(note: FNote | null) {
if (isContentEmpty) {
classes.push("note-no-content");
}
- content = `<h5 class="${classes.join(" ")}">${noteTitleWithPathAsSuffix.prop("outerHTML")}</h5>`;
+ content = `<h5 class="${classes.join(" ")}"><a href="#${note.noteId}" data-no-context-menu="true">${noteTitleWithPathAsSuffix.prop("outerHTML")}</a></h5>`;
}
content = `${content}<div class="note-tooltip-attributes">${$renderedAttributes[0].outerHTML}</div>`;
diff --git a/src/public/stylesheets/theme-next/shell.css b/src/public/stylesheets/theme-next/shell.css
index 8b703eb857..acf7818f0d 100644
--- a/src/public/stylesheets/theme-next/shell.css
+++ b/src/public/stylesheets/theme-next/shell.css
@@ -1214,6 +1214,10 @@ body .calendar-dropdown-widget .calendar-body a:hover {
flex-direction: column-reverse;
}
+.note-tooltip-title a {
+ color: inherit !important;
+}
+
.note-tooltip-title.note-no-content {
margin: 0;
}