feat(collection/presentation): support gradients as well

This commit is contained in:
Elian Doran 2025-10-17 09:34:40 +03:00
parent bbda8d3357
commit d9b4f7345b
No known key found for this signature in database
2 changed files with 7 additions and 1 deletions

View File

@ -178,6 +178,7 @@ function Slide({ slide }: { slide: PresentationSlideBaseModel }) {
<section
data-note-id={slide.noteId}
data-background-color={slide.backgroundColor}
data-background-gradient={slide.backgroundGradient}
dangerouslySetInnerHTML={slide.content}
/>
);

View File

@ -13,6 +13,7 @@ export interface PresentationSlideBaseModel {
noteId: string;
content: DangerouslySetInnerHTML;
backgroundColor?: string;
backgroundGradient?: string;
}
export interface PresentationModel {
@ -39,10 +40,14 @@ async function buildVerticalSlides(parentSlideNote: FNote): Promise<undefined |
}
async function buildSlideModel(note: FNote): Promise<PresentationSlideBaseModel> {
const slideBackground = note.getLabelValue("slide:background") ?? undefined;
const isGradient = slideBackground?.includes("gradient(");
return {
noteId: note.noteId,
content: await processContent(note),
backgroundColor: note.getLabelValue("slide:background") ?? undefined
backgroundColor: !isGradient ? slideBackground : undefined,
backgroundGradient: isGradient ? slideBackground : undefined
}
}