diff --git a/apps/client/src/widgets/collections/presentation/index.tsx b/apps/client/src/widgets/collections/presentation/index.tsx index e9d7eecec..34c664247 100644 --- a/apps/client/src/widgets/collections/presentation/index.tsx +++ b/apps/client/src/widgets/collections/presentation/index.tsx @@ -85,9 +85,18 @@ function Presentation({ presentation } : { presentation: PresentationModel }) { } function Slide({ slide }: { slide: PresentationSlideModel }) { - return ( -
- {slide.content} -
- ); + if (!slide.verticalSlides) { + // Normal slide. + return
; + } else { + // Slide with sub notes (show as vertical slides). + return ( +
+
+ {slide.verticalSlides.map((slide) => ( +
+ ))} +
+ ) + } } diff --git a/apps/client/src/widgets/collections/presentation/model.ts b/apps/client/src/widgets/collections/presentation/model.ts index c87a8c9d6..838cf7a4c 100644 --- a/apps/client/src/widgets/collections/presentation/model.ts +++ b/apps/client/src/widgets/collections/presentation/model.ts @@ -1,7 +1,14 @@ import FNote from "../../../entities/fnote"; +type DangerouslySetInnerHTML = { __html: string; }; + export interface PresentationSlideModel { - content: { __html: string; }; + content: DangerouslySetInnerHTML; + verticalSlides: PresentationVerticalSlideModel[] | undefined; +} + +interface PresentationVerticalSlideModel { + content: DangerouslySetInnerHTML; } export interface PresentationModel { @@ -15,13 +22,27 @@ export async function buildPresentationModel(note: FNote): Promise { + const children = await parentSlideNote.getChildNotes(); + if (!children.length) return; + + const slides: PresentationVerticalSlideModel[] = []; + for (const child of children) { + slides.push({ + content: processContent(await child.getContent()) + }); + } + return slides; +} + +function processContent(content: string | undefined): DangerouslySetInnerHTML { + return { __html: content ?? "" }; }