Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
chore(print/list): get note titles to render
Elian Doran7f81b839550d
diff --git a/apps/client/src/widgets/collections/NoteList.tsx b/apps/client/src/widgets/collections/NoteList.tsxindex 1d5a968106..860886a0f0 100644--- a/apps/client/src/widgets/collections/NoteList.tsx+++ b/apps/client/src/widgets/collections/NoteList.tsx@@ -2,7 +2,7 @@ import { allViewTypes, ViewModeMedia, ViewModeProps, ViewTypeOptions } from "./iimport { useNoteContext, useNoteLabel, useNoteLabelBoolean, useTriliumEvent } from "../react/hooks";import FNote from "../../entities/fnote";import "./NoteList.css";-import { ListView, GridView } from "./legacy/ListOrGridView";+import { ListView, GridView, ListPrintView } from "./legacy/ListOrGridView";import { useEffect, useRef, useState } from "preact/hooks";import GeoView from "./geomap";import ViewModeStorage from "./view_mode_storage";@@ -103,7 +103,11 @@ export function CustomNoteList({ note, viewType, isEnabled: shouldEnable, notePafunction getComponentByViewType(viewType: ViewTypeOptions, props: ViewModeProps<any>) {switch (viewType) {case "list":- return <ListView {...props} />;+ if (props.media !== "print") {+ return <ListView {...props} />;+ } else {+ return <ListPrintView {...props} />;+ }case "grid":return <GridView {...props} />;case "geoMap":diff --git a/apps/client/src/widgets/collections/legacy/ListOrGridView.tsx b/apps/client/src/widgets/collections/legacy/ListOrGridView.tsxindex ef37b6685e..db5a885936 100644--- a/apps/client/src/widgets/collections/legacy/ListOrGridView.tsx+++ b/apps/client/src/widgets/collections/legacy/ListOrGridView.tsx@@ -11,6 +11,7 @@ import tree from "../../../services/tree";import link from "../../../services/link";import { t } from "../../../services/i18n";import attribute_renderer from "../../../services/attribute_renderer";+import froca from "../../../services/froca";export function ListView({ note, noteIds: unfilteredNoteIds, highlightedTokens }: ViewModeProps<{}>) {const [ isExpanded ] = useNoteLabelBoolean(note, "expanded");@@ -34,6 +35,25 @@ export function ListView({ note, noteIds: unfilteredNoteIds, highlightedTokens });}+export function ListPrintView({ note, noteIds: unfilteredNoteIds, highlightedTokens }: ViewModeProps<{}>) {+ const noteIds = useFilteredNoteIds(note, unfilteredNoteIds);+ const [ notes, setNotes ] = useState<FNote[]>();++ useEffect(() => {+ froca.getNotes(noteIds).then(setNotes);+ }, [noteIds]);++ return (+ <div class="note-list list-print-view">+ <div class="note-list-container use-tn-links">+ {notes?.map(childNote => (+ <h1>{childNote.title}</h1>+ ))}+ </div>+ </div>+ );+}+export function GridView({ note, noteIds: unfilteredNoteIds, highlightedTokens }: ViewModeProps<{}>) {const noteIds = useFilteredNoteIds(note, unfilteredNoteIds);const { pageNotes, ...pagination } = usePagination(note, noteIds);