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 <section
data-note-id={slide.noteId} data-note-id={slide.noteId}
data-background-color={slide.backgroundColor} data-background-color={slide.backgroundColor}
data-background-gradient={slide.backgroundGradient}
dangerouslySetInnerHTML={slide.content} dangerouslySetInnerHTML={slide.content}
/> />
); );

View File

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