mirror of
https://github.com/zadam/trilium.git
synced 2025-11-21 08:04:24 +01:00
chore(print/list): get note titles to render
This commit is contained in:
parent
165357f444
commit
7f81b83955
@ -2,7 +2,7 @@ import { allViewTypes, ViewModeMedia, ViewModeProps, ViewTypeOptions } from "./i
|
|||||||
import { useNoteContext, useNoteLabel, useNoteLabelBoolean, useTriliumEvent } from "../react/hooks";
|
import { useNoteContext, useNoteLabel, useNoteLabelBoolean, useTriliumEvent } from "../react/hooks";
|
||||||
import FNote from "../../entities/fnote";
|
import FNote from "../../entities/fnote";
|
||||||
import "./NoteList.css";
|
import "./NoteList.css";
|
||||||
import { ListView, GridView } from "./legacy/ListOrGridView";
|
import { ListView, GridView, ListPrintView } from "./legacy/ListOrGridView";
|
||||||
import { useEffect, useRef, useState } from "preact/hooks";
|
import { useEffect, useRef, useState } from "preact/hooks";
|
||||||
import GeoView from "./geomap";
|
import GeoView from "./geomap";
|
||||||
import ViewModeStorage from "./view_mode_storage";
|
import ViewModeStorage from "./view_mode_storage";
|
||||||
@ -103,7 +103,11 @@ export function CustomNoteList({ note, viewType, isEnabled: shouldEnable, notePa
|
|||||||
function getComponentByViewType(viewType: ViewTypeOptions, props: ViewModeProps<any>) {
|
function getComponentByViewType(viewType: ViewTypeOptions, props: ViewModeProps<any>) {
|
||||||
switch (viewType) {
|
switch (viewType) {
|
||||||
case "list":
|
case "list":
|
||||||
return <ListView {...props} />;
|
if (props.media !== "print") {
|
||||||
|
return <ListView {...props} />;
|
||||||
|
} else {
|
||||||
|
return <ListPrintView {...props} />;
|
||||||
|
}
|
||||||
case "grid":
|
case "grid":
|
||||||
return <GridView {...props} />;
|
return <GridView {...props} />;
|
||||||
case "geoMap":
|
case "geoMap":
|
||||||
|
|||||||
@ -11,6 +11,7 @@ import tree from "../../../services/tree";
|
|||||||
import link from "../../../services/link";
|
import link from "../../../services/link";
|
||||||
import { t } from "../../../services/i18n";
|
import { t } from "../../../services/i18n";
|
||||||
import attribute_renderer from "../../../services/attribute_renderer";
|
import attribute_renderer from "../../../services/attribute_renderer";
|
||||||
|
import froca from "../../../services/froca";
|
||||||
|
|
||||||
export function ListView({ note, noteIds: unfilteredNoteIds, highlightedTokens }: ViewModeProps<{}>) {
|
export function ListView({ note, noteIds: unfilteredNoteIds, highlightedTokens }: ViewModeProps<{}>) {
|
||||||
const [ isExpanded ] = useNoteLabelBoolean(note, "expanded");
|
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<{}>) {
|
export function GridView({ note, noteIds: unfilteredNoteIds, highlightedTokens }: ViewModeProps<{}>) {
|
||||||
const noteIds = useFilteredNoteIds(note, unfilteredNoteIds);
|
const noteIds = useFilteredNoteIds(note, unfilteredNoteIds);
|
||||||
const { pageNotes, ...pagination } = usePagination(note, noteIds);
|
const { pageNotes, ...pagination } = usePagination(note, noteIds);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user