diff --git a/components/presentation/Presentation.css b/components/presentation/Presentation.css index df4d5c6..82549b8 100644 --- a/components/presentation/Presentation.css +++ b/components/presentation/Presentation.css @@ -28,6 +28,25 @@ color: white !important; } +/* 带背景的幻灯片文字颜色 */ +.reveal-container .reveal .slides section[data-background] { + color: white !important; +} + +.reveal-container .reveal .slides section[data-background] h1, +.reveal-container .reveal .slides section[data-background] h2, +.reveal-container .reveal .slides section[data-background] h3, +.reveal-container .reveal .slides section[data-background] h4, +.reveal-container .reveal .slides section[data-background] h5, +.reveal-container .reveal .slides section[data-background] h6 { + color: white !important; +} + +.reveal-container .reveal .slides section[data-background] p, +.reveal-container .reveal .slides section[data-background] li { + color: rgba(255, 255, 255, 0.9) !important; +} + .reveal-container .reveal .slides section h1, .reveal-container .reveal .slides section h2, .reveal-container .reveal .slides section h3, diff --git a/components/presentation/Presentation.jsx b/components/presentation/Presentation.jsx index cd11765..8717e4f 100644 --- a/components/presentation/Presentation.jsx +++ b/components/presentation/Presentation.jsx @@ -25,7 +25,7 @@ const REVEAL_CONFIG = { fragmentInURL: false, embedded: false, help: true, - showNotes: false, + showNotes: true, autoPlayMedia: null, preloadIframes: null, autoSlide: 0, @@ -99,14 +99,24 @@ export default function Presentation({ data }) { const trimmedSection = section.trim(); if (!trimmedSection) return ''; - const htmlContent = marked(trimmedSection); + // 检查是否有背景设置 + const backgroundMatch = trimmedSection.match(//); + let backgroundAttr = ''; + let contentWithoutBackground = trimmedSection; + + if (backgroundMatch) { + backgroundAttr = ` data-background="${backgroundMatch[1]}"`; + contentWithoutBackground = trimmedSection.replace(//g, ''); + } + + const htmlContent = marked(contentWithoutBackground); // 如果是第一个幻灯片且没有标题,添加标题 if (index === 0 && !htmlContent.includes('

') && data.title) { - return `

${data.title}

${htmlContent}
`; + return `

${data.title}

${htmlContent}`; } - return `
${htmlContent}
`; + return `${htmlContent}`; }).join(''); };