diff --git a/apps/client/src/layouts/desktop_layout.tsx b/apps/client/src/layouts/desktop_layout.tsx index 9dc4b76ee..3f9416584 100644 --- a/apps/client/src/layouts/desktop_layout.tsx +++ b/apps/client/src/layouts/desktop_layout.tsx @@ -138,7 +138,7 @@ export default class DesktopLayout { .child(new PromotedAttributesWidget()) .child() .child(new NoteDetailWidget()) - .child() + .child() .child() .child() .child() diff --git a/apps/client/src/layouts/layout_commons.tsx b/apps/client/src/layouts/layout_commons.tsx index 292006011..610f31dda 100644 --- a/apps/client/src/layouts/layout_commons.tsx +++ b/apps/client/src/layouts/layout_commons.tsx @@ -66,6 +66,6 @@ export function applyModals(rootContainer: RootContainer) { .child() .child(new PromotedAttributesWidget()) .child(new NoteDetailWidget()) - .child()) + .child()) .child(); } diff --git a/apps/client/src/layouts/mobile_layout.tsx b/apps/client/src/layouts/mobile_layout.tsx index 3d21b9405..b952c2d0b 100644 --- a/apps/client/src/layouts/mobile_layout.tsx +++ b/apps/client/src/layouts/mobile_layout.tsx @@ -154,7 +154,7 @@ export default class MobileLayout { .filling() .contentSized() .child(new NoteDetailWidget()) - .child() + .child() .child() ) .child() diff --git a/apps/client/src/print.tsx b/apps/client/src/print.tsx index ed3d83c6a..5bfd0d5f1 100644 --- a/apps/client/src/print.tsx +++ b/apps/client/src/print.tsx @@ -32,6 +32,7 @@ function handleCollection(note: FNote) { notePath={note.getBestNotePath().join("/")} ntxId="print" highlightedTokens={null} + media="print" /> ); } diff --git a/apps/client/src/widgets/collections/NoteList.tsx b/apps/client/src/widgets/collections/NoteList.tsx index ba7d21d0c..11abcc5c2 100644 --- a/apps/client/src/widgets/collections/NoteList.tsx +++ b/apps/client/src/widgets/collections/NoteList.tsx @@ -1,4 +1,4 @@ -import { allViewTypes, ViewModeProps, ViewTypeOptions } from "./interface"; +import { allViewTypes, ViewModeMedia, ViewModeProps, ViewTypeOptions } from "./interface"; import { useNoteContext, useNoteLabel, useNoteLabelBoolean, useTriliumEvent } from "../react/hooks"; import FNote from "../../entities/fnote"; import "./NoteList.css"; @@ -22,9 +22,10 @@ interface NoteListProps { displayOnlyCollections?: boolean; isEnabled: boolean; ntxId: string | null | undefined; + media: ViewModeMedia; } -export default function NoteList(props: Pick) { +export default function NoteList(props: Pick) { const { note, noteContext, notePath, ntxId } = useNoteContext(); const isEnabled = noteContext?.hasNoteList(); return @@ -34,7 +35,7 @@ export function SearchNoteList(props: Omit } -export function CustomNoteList({ note, isEnabled: shouldEnable, notePath, highlightedTokens, displayOnlyCollections, ntxId }: NoteListProps) { +export function CustomNoteList({ note, isEnabled: shouldEnable, notePath, highlightedTokens, displayOnlyCollections, ntxId, ...restProps }: NoteListProps) { const widgetRef = useRef(null); const viewType = useNoteViewType(note); const noteIds = useNoteIds(note, viewType, ntxId); @@ -76,7 +77,8 @@ export function CustomNoteList({ note, isEnabled: shouldEnable note, noteIds, notePath, highlightedTokens, viewConfig: viewModeConfig[0], - saveConfig: viewModeConfig[1] + saveConfig: viewModeConfig[1], + ...restProps } } diff --git a/apps/client/src/widgets/collections/interface.ts b/apps/client/src/widgets/collections/interface.ts index 91b9f301b..81a8e4d3d 100644 --- a/apps/client/src/widgets/collections/interface.ts +++ b/apps/client/src/widgets/collections/interface.ts @@ -3,6 +3,8 @@ import FNote from "../../entities/fnote"; export const allViewTypes = ["list", "grid", "calendar", "table", "geoMap", "board", "presentation"] as const; export type ViewTypeOptions = typeof allViewTypes[number]; +export type ViewModeMedia = "screen" | "print"; + export interface ViewModeProps { note: FNote; notePath: string; @@ -13,4 +15,5 @@ export interface ViewModeProps { highlightedTokens: string[] | null | undefined; viewConfig: T | undefined; saveConfig(newConfig: T): void; + media: ViewModeMedia; } diff --git a/apps/client/src/widgets/collections/presentation/index.tsx b/apps/client/src/widgets/collections/presentation/index.tsx index 6ed58c796..297b7f0e5 100644 --- a/apps/client/src/widgets/collections/presentation/index.tsx +++ b/apps/client/src/widgets/collections/presentation/index.tsx @@ -14,7 +14,7 @@ import { t } from "../../../services/i18n"; import { DEFAULT_THEME, loadPresentationTheme } from "./themes"; import FNote from "../../../entities/fnote"; -export default function PresentationView({ note, noteIds }: ViewModeProps<{}>) { +export default function PresentationView({ note, noteIds, media }: ViewModeProps<{}>) { const [ presentation, setPresentation ] = useState(); const containerRef = useRef(null); const [ api, setApi ] = useState(); @@ -33,18 +33,28 @@ export default function PresentationView({ note, noteIds }: ViewModeProps<{}>) { useLayoutEffect(refresh, [ note, noteIds ]); - return presentation && stylesheets && ( + if (!presentation || !stylesheets) return; + const content = ( <> - - {stylesheets.map(stylesheet => )} - - - + {stylesheets.map(stylesheet => )} + - ) + ); + + if (media === "screen") { + return ( + <> + {content} + + + ) + } else { + // Shadow DOM doesn't work well with Reveal.js's PDF printing mechanism. + return content; + } } function usePresentationStylesheets(note: FNote) { @@ -128,6 +138,7 @@ function Presentation({ presentation, setApi } : { presentation: PresentationMod const api = new Reveal(containerRef.current, { transition: "slide", embedded: true, + pdfMaxPagesPerSlide: 1, keyboardCondition(event) { // Full-screen requests sometimes fail, we rely on the UI button instead. if (event.key === "f") { diff --git a/apps/client/src/widgets/search_result.tsx b/apps/client/src/widgets/search_result.tsx index 6c1c07419..fd3c24ab4 100644 --- a/apps/client/src/widgets/search_result.tsx +++ b/apps/client/src/widgets/search_result.tsx @@ -54,6 +54,7 @@ export default function SearchResult() { {state === SearchResultState.GOT_RESULTS && (