From 8810bd753c4097796e7fcb66f2667e161b941e13 Mon Sep 17 00:00:00 2001 From: jingrow Date: Wed, 3 Sep 2025 16:06:27 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E6=9E=84Presentation=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E4=B8=BA=E5=86=85=E7=BD=AEcss=E6=A0=B7=E5=BC=8F?= =?UTF-8?q?=EF=BC=8C=E7=BE=8E=E5=8C=96=E9=BB=98=E8=AE=A4=E6=95=88=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/presentation/Presentation.css | 45 ------- components/presentation/Presentation.jsx | 136 ++++++++++----------- components/presentation/themes/jingrow.css | 16 +++ data/presentation/jingrow.md | 2 +- 4 files changed, 84 insertions(+), 115 deletions(-) delete mode 100644 components/presentation/Presentation.css diff --git a/components/presentation/Presentation.css b/components/presentation/Presentation.css deleted file mode 100644 index 3f38233..0000000 --- a/components/presentation/Presentation.css +++ /dev/null @@ -1,45 +0,0 @@ -/* Jingrow 图标定义 */ -.jingrow-icon { - display: inline-block; - width: 1.5em; - height: 1.5em; - vertical-align: middle; - margin-right: 0.5em; - background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' version='1.1' viewBox='0.00 0.00 128.00 128.00'%3E%3Cg stroke-width='2.00' fill='none' stroke-linecap='butt'%3E%3Cpath stroke='%238fe3b1' vector-effect='non-scaling-stroke' d='M 64.04 34.07 Q 64.93 34.07 65.55 34.69 Q 74.55 43.60 82.91 51.96 C 87.46 56.52 91.92 55.95 98.45 55.81 A 2.52 2.52 0.0 0 0 100.92 53.29 L 100.92 49.89 A 2.56 2.55 -1.5 0 0 98.23 47.34 C 95.84 47.46 91.15 47.62 89.22 45.67 Q 81.61 37.99 68.36 24.99 Q 66.43 23.09 64.04 23.09 Q 61.66 23.09 59.72 24.99 Q 46.47 37.98 38.85 45.66 C 36.92 47.61 32.23 47.45 29.84 47.32 A 2.56 2.55 1.5 0 0 27.15 49.87 L 27.15 53.27 A 2.52 2.52 0.0 0 0 29.62 55.79 C 36.15 55.94 40.61 56.51 45.16 51.95 Q 53.53 43.60 62.53 34.69 Q 63.15 34.07 64.04 34.07'%3E%3C/path%3E%3Cpath stroke='%238fe3b1' vector-effect='non-scaling-stroke' d='M 64.04 101.46 C 66.42 101.46 68.47 101.10 68.47 98.24 Q 68.49 75.28 68.49 72.56 A 0.61 0.61 0.0 0 1 69.10 71.95 L 89.64 71.95 A 2.50 2.50 0.0 0 0 92.14 69.45 L 92.14 65.73 A 2.28 2.28 0.0 0 0 89.86 63.45 L 69.10 63.45 A 0.61 0.61 0.0 0 1 68.49 62.84 L 68.49 50.37 A 3.05 3.03 2.1 0 0 65.67 47.34 Q 65.14 47.31 64.03 47.31 Q 62.93 47.31 62.40 47.34 A 3.05 3.03 -2.1 0 0 59.58 50.37 L 59.58 62.84 A 0.61 0.61 0.0 0 1 58.97 63.45 L 38.21 63.45 A 2.28 2.28 0.0 0 0 35.93 65.73 L 35.93 69.45 A 2.50 2.50 0.0 0 0 38.43 71.95 L 58.97 71.95 A 0.61 0.61 0.0 0 1 59.58 72.56 Q 59.58 75.28 59.60 98.24 C 59.60 101.10 61.65 101.46 64.04 101.46'%3E%3C/path%3E%3C/g%3E%3Cpath fill='%231fc76f' d='M 115.34 95.08 A 19.82 19.82 0.0 0 1 95.52 114.90 L 32.48 114.90 A 19.82 19.82 0.0 0 1 12.66 95.08 L 12.66 32.88 A 19.82 19.82 0.0 0 1 32.48 13.06 L 95.52 13.06 A 19.82 19.82 0.0 0 1 115.34 32.88 L 115.34 95.08 Z M 64.04 34.07 Q 64.93 34.07 65.55 34.69 Q 74.55 43.60 82.91 51.96 C 87.46 56.52 91.92 55.95 98.45 55.81 A 2.52 2.52 0.0 0 0 100.92 53.29 L 100.92 49.89 A 2.56 2.55 -1.5 0 0 98.23 47.34 C 95.84 47.46 91.15 47.62 89.22 45.67 Q 81.61 37.99 68.36 24.99 Q 66.43 23.09 64.04 23.09 Q 61.66 23.09 59.72 24.99 Q 46.47 37.98 38.85 45.66 C 36.92 47.61 32.23 47.45 29.84 47.32 A 2.56 2.55 1.5 0 0 27.15 49.87 L 27.15 53.27 A 2.52 2.52 0.0 0 0 29.62 55.79 C 36.15 55.94 40.61 56.51 45.16 51.95 Q 53.53 43.60 62.53 34.69 Q 63.15 34.07 64.04 34.07 Z M 64.04 101.46 C 66.42 101.46 68.47 101.10 68.47 98.24 Q 68.49 75.28 68.49 72.56 A 0.61 0.61 0.0 0 1 69.10 71.95 L 89.64 71.95 A 2.50 2.50 0.0 0 0 92.14 69.45 L 92.14 65.73 A 2.28 2.28 0.0 0 0 89.86 63.45 L 69.10 63.45 A 0.61 0.61 0.0 0 1 68.49 62.84 L 68.49 50.37 A 3.05 3.03 2.1 0 0 65.67 47.34 Q 65.14 47.31 64.03 47.31 Q 62.93 47.31 62.40 47.34 A 3.05 3.03 -2.1 0 0 59.58 50.37 L 59.58 62.84 A 0.61 0.61 0.0 0 1 58.97 63.45 L 38.21 63.45 A 2.28 2.28 0.0 0 0 35.93 65.73 L 35.93 69.45 A 2.50 2.50 0.0 0 0 38.43 71.95 L 58.97 71.95 A 0.61 0.61 0.0 0 1 59.58 72.56 Q 59.58 75.28 59.60 98.24 C 59.60 101.10 61.65 101.46 64.04 101.46 Z'%3E%3C/path%3E%3Cpath fill='%23fffef2' d='M 64.04 23.09 Q 66.43 23.09 68.36 24.99 Q 81.61 37.99 89.22 45.67 C 91.15 47.62 95.84 47.46 98.23 47.34 A 2.56 2.55 -1.5 0 1 100.92 49.89 L 100.92 53.29 A 2.52 2.52 0.0 0 1 98.45 55.81 C 91.92 55.95 87.46 56.52 82.91 51.96 Q 74.55 43.60 65.55 34.69 Q 64.93 34.07 64.04 34.07 Q 63.15 34.07 62.53 34.69 Q 53.53 43.60 45.16 51.95 C 40.61 56.51 36.15 55.94 29.62 55.79 A 2.52 2.52 0.0 0 1 27.15 53.27 L 27.15 49.87 A 2.56 2.55 1.5 0 1 29.84 47.32 C 32.23 47.45 36.92 47.61 38.85 45.66 Q 46.47 37.98 59.72 24.99 Q 61.66 23.09 64.04 23.09 Z'%3E%3C/path%3E%3Cpath fill='%23fffef2' d='M 64.03 47.31 Q 65.14 47.31 65.67 47.34 A 3.05 3.03 2.1 0 1 68.49 50.37 L 68.49 62.84 A 0.61 0.61 0.0 0 0 69.10 63.45 L 89.86 63.45 A 2.28 2.28 0.0 0 1 92.14 65.73 L 92.14 69.45 A 2.50 2.50 0.0 0 1 89.64 71.95 L 69.10 71.95 A 0.61 0.61 0.0 0 0 68.49 72.56 Q 68.49 75.28 68.47 98.24 C 68.47 101.10 66.42 101.46 64.04 101.46 C 61.65 101.46 59.60 101.10 59.60 98.24 Q 59.58 75.28 59.58 72.56 A 0.61 0.61 0.0 0 0 58.97 71.95 L 38.43 71.95 A 2.50 2.50 0.0 0 1 35.93 69.45 L 35.93 65.73 A 2.28 2.28 0.0 0 1 38.21 63.45 L 58.97 63.45 A 0.61 0.61 0.0 0 0 59.58 62.84 L 59.58 50.37 A 3.05 3.03 -2.1 0 1 62.40 47.34 Q 62.93 47.31 64.03 47.31 Z'%3E%3C/path%3E%3C/svg%3E"); - background-repeat: no-repeat; - background-size: contain; -} - -.jingrow-icon-large { - width: 2em; - height: 2em; -} - -/* 容器布局样式 */ -.reveal-container { - height: 100vh; - width: 100%; - position: fixed; - top: 0; - left: 0; - z-index: 1000; -} - -.reveal-container .reveal { - height: 100% !important; - width: 100% !important; -} - -.reveal-container .reveal .slides { - height: 100% !important; -} - -.reveal-container .reveal .slides section { - height: 100% !important; - display: flex !important; - flex-direction: column !important; - justify-content: center !important; - align-items: center !important; - text-align: center !important; - padding: 2rem !important; -} diff --git a/components/presentation/Presentation.jsx b/components/presentation/Presentation.jsx index 01f45e1..671d47d 100644 --- a/components/presentation/Presentation.jsx +++ b/components/presentation/Presentation.jsx @@ -4,7 +4,6 @@ import { useEffect, useRef, useState, useCallback, useMemo } from 'react'; import Reveal from 'reveal.js'; import 'reveal.js/dist/reveal.css'; import { marked } from 'marked'; -import './Presentation.css'; // 简单的动态主题加载器 const loadTheme = async (themeName) => { @@ -97,13 +96,8 @@ export default function Presentation({ data }) { return parseContentSlides(data); } - // 如果没有 content 字段,使用 items 数据构建幻灯片 - const items = data.items || []; - if (items.length === 0) { - return parseSingleSlide(data); - } - - return parseItemsSlides(items); + // 如果没有 content 字段,返回默认内容 + return `

${data.title || '演示文稿'}

暂无内容

`; } catch (err) { console.error('解析幻灯片内容失败:', err); return `

解析错误

内容解析失败,请检查数据格式

`; @@ -140,56 +134,6 @@ export default function Presentation({ data }) { }).join(''); }; - // 解析单个幻灯片 - const parseSingleSlide = (data) => { - return `
-

${data.title || '演示文稿'}

- ${data.subtitle ? `

${data.subtitle}

` : ''} - ${data.description ? `
${marked(data.description)}
` : ''} - ${data.image ? `${data.title}` : ''} -
`; - }; - - // 解析items数组的幻灯片 - const parseItemsSlides = (items) => { - return items.map((item, index) => { - const slideContent = []; - - if (item.item_title) { - slideContent.push(`

${item.item_title}

`); - } - - if (item.item_subtitle) { - slideContent.push(`

${item.item_subtitle}

`); - } - - if (item.item_description) { - slideContent.push(`
${marked(item.item_description)}
`); - } - - if (item.item_image) { - slideContent.push(`${item.item_title || 'Slide'}`); - } - - if (item.item_video_src) { - slideContent.push(``); - } - - if (item.item_button_text && item.item_button_link) { - slideContent.push(`
- - ${item.item_button_text} - -
`); - } - - return `
${slideContent.join('')}
`; - }).join(''); - }; - // 初始化Reveal.js const initializeReveal = useCallback(async () => { if (!deckRef.current || !data) return; @@ -217,7 +161,6 @@ export default function Presentation({ data }) { setError(null); } catch (err) { - console.error('Reveal.js初始化失败:', err); setError('PPT初始化失败,请刷新页面重试'); } }, [data, parseMarkdownToSlides]); @@ -263,17 +206,72 @@ export default function Presentation({ data }) { } return ( -
-
-
-
-

正在加载内容...

-
+ <> +
+
+
+
+

正在加载内容...

+
+
-
+ + + ); } diff --git a/components/presentation/themes/jingrow.css b/components/presentation/themes/jingrow.css index 487b328..a7f602c 100644 --- a/components/presentation/themes/jingrow.css +++ b/components/presentation/themes/jingrow.css @@ -1,6 +1,22 @@ /* Jingrow 自定义主题 */ @import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700&display=swap'); +.jingrow-icon { + display: inline-block; + width: 1.5em; + height: 1.5em; + vertical-align: middle; + margin-right: 0.5em; + background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' version='1.1' viewBox='0.00 0.00 128.00 128.00'%3E%3Cg stroke-width='2.00' fill='none' stroke-linecap='butt'%3E%3Cpath stroke='%238fe3b1' vector-effect='non-scaling-stroke' d='M 64.04 34.07 Q 64.93 34.07 65.55 34.69 Q 74.55 43.60 82.91 51.96 C 87.46 56.52 91.92 55.95 98.45 55.81 A 2.52 2.52 0.0 0 0 100.92 53.29 L 100.92 49.89 A 2.56 2.55 -1.5 0 0 98.23 47.34 C 95.84 47.46 91.15 47.62 89.22 45.67 Q 81.61 37.99 68.36 24.99 Q 66.43 23.09 64.04 23.09 Q 61.66 23.09 59.72 24.99 Q 46.47 37.98 38.85 45.66 C 36.92 47.61 32.23 47.45 29.84 47.32 A 2.56 2.55 1.5 0 0 27.15 49.87 L 27.15 53.27 A 2.52 2.52 0.0 0 0 29.62 55.79 C 36.15 55.94 40.61 56.51 45.16 51.95 Q 53.53 43.60 62.53 34.69 Q 63.15 34.07 64.04 34.07'%3E%3C/path%3E%3Cpath stroke='%238fe3b1' vector-effect='non-scaling-stroke' d='M 64.04 101.46 C 66.42 101.46 68.47 101.10 68.47 98.24 Q 68.49 75.28 68.49 72.56 A 0.61 0.61 0.0 0 1 69.10 71.95 L 89.64 71.95 A 2.50 2.50 0.0 0 0 92.14 69.45 L 92.14 65.73 A 2.28 2.28 0.0 0 0 89.86 63.45 L 69.10 63.45 A 0.61 0.61 0.0 0 1 68.49 62.84 L 68.49 50.37 A 3.05 3.03 2.1 0 0 65.67 47.34 Q 65.14 47.31 64.03 47.31 Q 62.93 47.31 62.40 47.34 A 3.05 3.03 -2.1 0 0 59.58 50.37 L 59.58 62.84 A 0.61 0.61 0.0 0 1 58.97 63.45 L 38.21 63.45 A 2.28 2.28 0.0 0 0 35.93 65.73 L 35.93 69.45 A 2.50 2.50 0.0 0 0 38.43 71.95 L 58.97 71.95 A 0.61 0.61 0.0 0 1 59.58 72.56 Q 59.58 75.28 59.60 98.24 C 59.60 101.10 61.65 101.46 64.04 101.46'%3E%3C/path%3E%3C/g%3E%3Cpath fill='%231fc76f' d='M 115.34 95.08 A 19.82 19.82 0.0 0 1 95.52 114.90 L 32.48 114.90 A 19.82 19.82 0.0 0 1 12.66 95.08 L 12.66 32.88 A 19.82 19.82 0.0 0 1 32.48 13.06 L 95.52 13.06 A 19.82 19.82 0.0 0 1 115.34 32.88 L 115.34 95.08 Z M 64.04 34.07 Q 64.93 34.07 65.55 34.69 Q 74.55 43.60 82.91 51.96 C 87.46 56.52 91.92 55.95 98.45 55.81 A 2.52 2.52 0.0 0 0 100.92 53.29 L 100.92 49.89 A 2.56 2.55 -1.5 0 0 98.23 47.34 C 95.84 47.46 91.15 47.62 89.22 45.67 Q 81.61 37.99 68.36 24.99 Q 66.43 23.09 64.04 23.09 Q 61.66 23.09 59.72 24.99 Q 46.47 37.98 38.85 45.66 C 36.92 47.61 32.23 47.45 29.84 47.32 A 2.56 2.55 1.5 0 0 27.15 49.87 L 27.15 53.27 A 2.52 2.52 0.0 0 0 29.62 55.79 C 36.15 55.94 40.61 56.51 45.16 51.95 Q 53.53 43.60 62.53 34.69 Q 63.15 34.07 64.04 34.07 Z M 64.04 101.46 C 66.42 101.46 68.47 101.10 68.47 98.24 Q 68.49 75.28 68.49 72.56 A 0.61 0.61 0.0 0 1 69.10 71.95 L 89.64 71.95 A 2.50 2.50 0.0 0 0 92.14 69.45 L 92.14 65.73 A 2.28 2.28 0.0 0 0 89.86 63.45 L 69.10 63.45 A 0.61 0.61 0.0 0 1 68.49 62.84 L 68.49 50.37 A 3.05 3.03 2.1 0 0 65.67 47.34 Q 65.14 47.31 64.03 47.31 Q 62.93 47.31 62.40 47.34 A 3.05 3.03 -2.1 0 0 59.58 50.37 L 59.58 62.84 A 0.61 0.61 0.0 0 1 58.97 63.45 L 38.21 63.45 A 2.28 2.28 0.0 0 0 35.93 65.73 L 35.93 69.45 A 2.50 2.50 0.0 0 0 38.43 71.95 L 58.97 71.95 A 0.61 0.61 0.0 0 1 59.58 72.56 Q 59.58 75.28 59.60 98.24 C 59.60 101.10 61.65 101.46 64.04 101.46 Z'%3E%3C/path%3E%3Cpath fill='%23fffef2' d='M 64.04 23.09 Q 66.43 23.09 68.36 24.99 Q 81.61 37.99 89.22 45.67 C 91.15 47.62 95.84 47.46 98.23 47.34 A 2.56 2.55 -1.5 0 1 100.92 49.89 L 100.92 53.29 A 2.52 2.52 0.0 0 1 98.45 55.81 C 91.92 55.95 87.46 56.52 82.91 51.96 Q 74.55 43.60 65.55 34.69 Q 64.93 34.07 64.04 34.07 Q 63.15 34.07 62.53 34.69 Q 53.53 43.60 45.16 51.95 C 40.61 56.51 36.15 55.94 29.62 55.79 A 2.52 2.52 0.0 0 1 27.15 53.27 L 27.15 49.87 A 2.56 2.55 1.5 0 1 29.84 47.32 C 32.23 47.45 36.92 47.61 38.85 45.66 Q 46.47 37.98 59.72 24.99 Q 61.66 23.09 64.04 23.09 Z'%3E%3C/path%3E%3Cpath fill='%23fffef2' d='M 64.03 47.31 Q 65.14 47.31 65.67 47.34 A 3.05 3.03 2.1 0 1 68.49 50.37 L 68.49 62.84 A 0.61 0.61 0.0 0 0 69.10 63.45 L 89.86 63.45 A 2.28 2.28 0.0 0 1 92.14 65.73 L 92.14 69.45 A 2.50 2.50 0.0 0 1 89.64 71.95 L 69.10 71.95 A 0.61 0.61 0.0 0 0 68.49 72.56 Q 68.49 75.28 68.47 98.24 C 68.47 101.10 66.42 101.46 64.04 101.46 C 61.65 101.46 59.60 101.10 59.60 98.24 Q 59.58 75.28 59.58 72.56 A 0.61 0.61 0.0 0 0 58.97 71.95 L 38.43 71.95 A 2.50 2.50 0.0 0 1 35.93 69.45 L 35.93 65.73 A 2.28 2.28 0.0 0 1 38.21 63.45 L 58.97 63.45 A 0.61 0.61 0.0 0 0 59.58 62.84 L 59.58 50.37 A 3.05 3.03 -2.1 0 1 62.40 47.34 Q 62.93 47.31 64.03 47.31 Z'%3E%3C/path%3E%3C/svg%3E"); + background-repeat: no-repeat; + background-size: contain; +} + +.jingrow-icon-large { + width: 2em; + height: 2em; +} + .reveal { font-family: 'Manrope', sans-serif; font-size: 24px; diff --git a/data/presentation/jingrow.md b/data/presentation/jingrow.md index 2b42488..0c1d208 100644 --- a/data/presentation/jingrow.md +++ b/data/presentation/jingrow.md @@ -1,5 +1,5 @@ --- -theme: white +theme: jingrow backgroundTransition: slide transition: slide ---