Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
feat(collection/presentation): support custom background color per slide
Elian Doranbbda8d33570c
diff --git a/apps/client/src/widgets/collections/presentation/index.tsx b/apps/client/src/widgets/collections/presentation/index.tsxindex 1d9896d35f..d9fabff100 100644--- a/apps/client/src/widgets/collections/presentation/index.tsx+++ b/apps/client/src/widgets/collections/presentation/index.tsx@@ -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) {diff --git a/apps/client/src/widgets/collections/presentation/model.ts b/apps/client/src/widgets/collections/presentation/model.tsindex 346adc505e..b0b4aa12c7 100644--- a/apps/client/src/widgets/collections/presentation/model.ts+++ b/apps/client/src/widgets/collections/presentation/model.ts@@ -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}}diff --git a/packages/commons/src/lib/attribute_names.ts b/packages/commons/src/lib/attribute_names.tsindex 314cc8c9c9..d55d4e3757 100644--- a/packages/commons/src/lib/attribute_names.ts+++ b/packages/commons/src/lib/attribute_names.ts@@ -40,6 +40,7 @@ type Labels = {maxNestingDepth: number;includeArchived: boolean;"presentation:theme": string;+ "slide:background": string;}/**