Skip to content

Build your personal knowledge base with Trilium Notes

chore(react/collections/list): add class to title

Elian Dorana9c5a3105fa3
diff --git a/apps/client/src/widgets/collections/legacy/ListView.tsx b/apps/client/src/widgets/collections/legacy/ListView.tsx
index c9fc455b1d..bb61ef04cd 100644
--- a/apps/client/src/widgets/collections/legacy/ListView.tsx
+++ b/apps/client/src/widgets/collections/legacy/ListView.tsx
@@ -54,7 +54,7 @@ function NoteCard({ note, expand }: { note: FNote, expand?: boolean }) {
/>
<Icon className="note-icon" icon={note.getIcon()} />
- <NoteLink notePath={notePath} noPreview showNotePath={isSearch} />
+ <NoteLink className="note-book-title" notePath={notePath} noPreview showNotePath={isSearch} />
{isExpanded && <>
<NoteContent note={note} />
<NoteChildren note={note} />
diff --git a/apps/client/src/widgets/react/NoteLink.tsx b/apps/client/src/widgets/react/NoteLink.tsx
index 221b902af2..09ed254d8a 100644
--- a/apps/client/src/widgets/react/NoteLink.tsx
+++ b/apps/client/src/widgets/react/NoteLink.tsx
@@ -3,6 +3,7 @@ import link from "../../services/link";
import RawHtml from "./RawHtml";
interface NoteLinkOpts {
+ className?: string;
notePath: string | string[];
showNotePath?: boolean;
showNoteIcon?: boolean;
@@ -11,7 +12,7 @@ interface NoteLinkOpts {
noTnLink?: boolean;
}
-export default function NoteLink({ notePath, showNotePath, showNoteIcon, style, noPreview, noTnLink }: NoteLinkOpts) {
+export default function NoteLink({ className, notePath, showNotePath, showNoteIcon, style, noPreview, noTnLink }: NoteLinkOpts) {
const stringifiedNotePath = Array.isArray(notePath) ? notePath.join("/") : notePath;
const [ jqueryEl, setJqueryEl ] = useState<JQuery<HTMLElement>>();
@@ -33,6 +34,10 @@ export default function NoteLink({ notePath, showNotePath, showNoteIcon, style,
$linkEl?.addClass("tn-link");
}
+ if (className) {
+ $linkEl?.addClass(className);
+ }
+
return <RawHtml html={jqueryEl} />
}
\ No newline at end of file
diff --git a/apps/client/src/widgets/view_widgets/list_or_grid_view.ts b/apps/client/src/widgets/view_widgets/list_or_grid_view.ts
index 857f1c6f0c..28f4fd53e9 100644
--- a/apps/client/src/widgets/view_widgets/list_or_grid_view.ts
+++ b/apps/client/src/widgets/view_widgets/list_or_grid_view.ts
@@ -61,7 +61,6 @@ class ListOrGridView extends ViewMode<{}> {
.append(
this.viewType === "grid"
? $('<span class="note-book-title">').text(await treeService.getNoteTitle(note.noteId, this.parentNote.noteId))
- : (await linkService.createLink(notePath, { showNotePath: this.showNotePath })).addClass("note-book-title")
)
.append($renderedAttributes)
);