feat(collection/presentation): support custom background color per slide

This commit is contained in:
Elian Doran 2025-10-17 09:28:44 +03:00
parent f377df32ed
commit bbda8d3357
No known key found for this signature in database
3 changed files with 11 additions and 2 deletions

View File

@ -174,7 +174,13 @@ function Presentation({ presentation, setApi } : { presentation: PresentationMod
}
function Slide({ slide }: { slide: PresentationSlideBaseModel }) {
return <section data-note-id={slide.noteId} dangerouslySetInnerHTML={slide.content} />;
return (
<section
data-note-id={slide.noteId}
data-background-color={slide.backgroundColor}
dangerouslySetInnerHTML={slide.content}
/>
);
}
function getNoteIdFromSlide(slide: HTMLElement | undefined) {

View File

@ -12,6 +12,7 @@ interface PresentationSlideModel extends PresentationSlideBaseModel {
export interface PresentationSlideBaseModel {
noteId: string;
content: DangerouslySetInnerHTML;
backgroundColor?: string;
}
export interface PresentationModel {
@ -40,7 +41,8 @@ async function buildVerticalSlides(parentSlideNote: FNote): Promise<undefined |
async function buildSlideModel(note: FNote): Promise<PresentationSlideBaseModel> {
return {
noteId: note.noteId,
content: await processContent(note)
content: await processContent(note),
backgroundColor: note.getLabelValue("slide:background") ?? undefined
}
}

View File

@ -40,6 +40,7 @@ type Labels = {
maxNestingDepth: number;
includeArchived: boolean;
"presentation:theme": string;
"slide:background": string;
}
/**