CatPtain commited on
Commit
f28b421
·
verified ·
1 Parent(s): 384fef6

Upload 8 files

Browse files
.env ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # PPTist Huggingface Space 环境配置
2
+
3
+ # GitHub 配置
4
+ GITHUB_TOKEN=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
5
+ GITHUB_REPOS=https://github.com/CaPaCaptain/PPTist_huggingface_db
6
+
7
+ # JWT 配置
8
+ JWT_SECRET=pptist-secret-key-2025-huggingface
9
+
10
+ # 应用配置
11
+ NODE_ENV=production
12
+ PORT=7860
.gitignore ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Dependencies
2
+ node_modules/
3
+ */node_modules/
4
+
5
+ # Production builds
6
+ dist/
7
+ build/
8
+
9
+ # Environment variables
10
+ .env
11
+ .env.local
12
+ .env.development.local
13
+ .env.test.local
14
+ .env.production.local
15
+
16
+ # Logs
17
+ logs
18
+ *.log
19
+ npm-debug.log*
20
+ yarn-debug.log*
21
+ yarn-error.log*
22
+
23
+ # Runtime data
24
+ pids
25
+ *.pid
26
+ *.seed
27
+ *.pid.lock
28
+
29
+ # Coverage directory used by tools like istanbul
30
+ coverage/
31
+
32
+ # OS generated files
33
+ .DS_Store
34
+ .DS_Store?
35
+ ._*
36
+ .Spotlight-V100
37
+ .Trashes
38
+ ehthumbs.db
39
+ Thumbs.db
40
+
41
+ # Editor directories and files
42
+ .vscode/
43
+ .idea/
44
+ *.suo
45
+ *.ntvs*
46
+ *.njsproj
47
+ *.sln
48
+ *.sw?
49
+
50
+ # Package files
51
+ *.tgz
52
+ *.zip
53
+
54
+ # Temporary files
55
+ tmp/
56
+ temp/
Dockerfile ADDED
@@ -0,0 +1,107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM node:18-alpine
2
+
3
+ # 安装系统依赖(无头浏览器已禁用)
4
+ RUN apk add --no-cache \
5
+ freetype \
6
+ freetype-dev \
7
+ harfbuzz \
8
+ ca-certificates \
9
+ ttf-freefont \
10
+ git \
11
+ python3 \
12
+ make \
13
+ g++ \
14
+ curl \
15
+ && rm -rf /var/cache/apk/*
16
+
17
+ # 无头浏览器功能已禁用
18
+ # ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true \
19
+ # PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser \
20
+ # PUPPETEER_CACHE_DIR=/tmp/.puppeteer_cache \
21
+ # PUPPETEER_ARGS="--no-sandbox --disable-setuid-sandbox --disable-dev-shm-usage" \
22
+ # PUPPETEER_DISABLE_HEADLESS_WARNING=true
23
+
24
+ # 设置Playwright环境变量 - 强制使用系统chromium
25
+ # ENV PLAYWRIGHT_BROWSERS_PATH=/usr/bin \
26
+ # PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=true \
27
+ # PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH=/usr/bin/chromium-browser \
28
+ # PLAYWRIGHT_SKIP_VALIDATE_HOST_REQUIREMENTS=true \
29
+ # PLAYWRIGHT_CHROMIUM_USE_HEADLESS_NEW=true
30
+
31
+ # 创建非root用户
32
+ RUN addgroup -g 1001 -S nodejs
33
+ RUN adduser -S nodejs -u 1001
34
+
35
+ # 创建数据目录并设置权限
36
+ RUN mkdir -p /data /data/images /data/metadata /data/users && \
37
+ chown -R nodejs:nodejs /data
38
+
39
+ # 创建缓存目录并设置权限
40
+ RUN mkdir -p /home/node/.cache && chown -R nodejs:nodejs /home/node/.cache
41
+
42
+ # 设置工作目录
43
+ WORKDIR /app
44
+
45
+ # 复制共享模块
46
+ COPY shared/ ./shared/
47
+ RUN chown -R nodejs:nodejs ./shared
48
+
49
+ # 复制前端所有文件(包括配置文件)
50
+ COPY frontend/ ./frontend/
51
+ RUN chown -R nodejs:nodejs ./frontend
52
+
53
+ # 复制根目录package.json
54
+ COPY package*.json ./
55
+
56
+ # 复制后端package.json和配置文件
57
+ COPY backend/package*.json ./backend/
58
+ COPY backend/.eslintrc.js ./backend/
59
+ COPY backend/.prettierrc ./backend/
60
+ COPY backend/babel.config.js ./backend/
61
+
62
+ # 安装前端依赖并构建
63
+ WORKDIR /app/frontend
64
+ USER nodejs
65
+ # 优化npm配置以提高构建稳定性
66
+ RUN npm config set fetch-retry-mintimeout 20000 && \
67
+ npm config set fetch-retry-maxtimeout 120000 && \
68
+ npm config set fetch-timeout 300000
69
+ RUN npm install
70
+ RUN npm run build
71
+
72
+ # 切换回root安装依赖
73
+ USER root
74
+ WORKDIR /app
75
+ RUN npm install --omit=dev
76
+
77
+ WORKDIR /app/backend
78
+ RUN npm install --omit=dev
79
+
80
+ # 验证系统依赖安装(chromium验证已移除)
81
+ RUN echo "System dependencies installed successfully"
82
+
83
+ # Playwright配置已禁用
84
+ # RUN mkdir -p /home/node/.cache/ms-playwright && \
85
+ # echo '{"browsers":[{"name":"chromium","executablePath":"/usr/bin/chromium-browser"}]}' > /home/node/.cache/ms-playwright/browsers.json && \
86
+ # chown -R node:node /home/node/.cache
87
+
88
+ # 复制后端代码
89
+ WORKDIR /app
90
+ COPY backend/ ./backend/
91
+ RUN chown -R nodejs:nodejs ./backend
92
+
93
+ # 设置工作目录为后端
94
+ WORKDIR /app/backend
95
+
96
+ # 切换到nodejs用户
97
+ USER nodejs
98
+
99
+ # 暴露端口
100
+ EXPOSE 7860
101
+
102
+ # 健康检查
103
+ HEALTHCHECK --interval=30s --timeout=10s --start-period=15s --retries=3 \
104
+ CMD curl -f http://localhost:7860/api/health || exit 1
105
+
106
+ # 启动应用
107
+ CMD ["npm", "start"]
data/backup-state.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "lastBackupTime": null,
3
+ "backupStats": {
4
+ "totalBackups": 0,
5
+ "successfulBackups": 0,
6
+ "failedBackups": 0,
7
+ "lastBackupResult": null
8
+ },
9
+ "savedAt": "2025-07-01T08:20:12.496Z"
10
+ }
data/persistent-links/link-map.json ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "version": "1.0",
3
+ "lastUpdated": "2025-06-30T08:51:50.490Z",
4
+ "persistentLinks": {
5
+ "bc11955adbe140b379d8": {
6
+ "linkId": "bc11955adbe140b379d8",
7
+ "userId": "PS02",
8
+ "pptId": "77330288-0b80-4c3b-987d-440b20282bc5",
9
+ "pageIndex": 0,
10
+ "createdAt": "2025-06-30T08:51:50.490Z",
11
+ "lastUpdated": "2025-06-30T08:51:50.490Z",
12
+ "updateCount": 0,
13
+ "hasImage": false
14
+ }
15
+ }
16
+ }
requirements.md ADDED
@@ -0,0 +1,280 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # 网页PPT后端系统需求文档
2
+
3
+ ## 项目概述
4
+
5
+ 本项目为网页PPT前端系统配套的后端服务,主要功能包括用户认证、PPT数据管理、分享功能、历史记录管理等。系统设计为部署在Hugging Face Space上,使用Docker容器化部署。
6
+
7
+ ## 技术架构
8
+
9
+ ### 部署环境
10
+ - **平台**: Hugging Face Space
11
+ - **容器化**: Docker
12
+ - **运行时**: Node.js 18 Alpine
13
+ - **端口**: 7860
14
+
15
+ ### 技术栈
16
+ - **后端框架**: Express.js + TypeScript
17
+ - **数据存储**:
18
+ - 临时数据库:内存存储(最大12GB)
19
+ - 永久数据库:GitHub仓库
20
+ - **图片处理**: Sharp
21
+ - **定时任务**: node-cron
22
+ - **安全**: Helmet, bcryptjs, express-rate-limit
23
+
24
+ ## 功能需求
25
+
26
+ ### 1. 用户认证系统
27
+
28
+ #### 1.1 内置账户
29
+ 系统不支持公开注册,仅提供4个预配置账户:
30
+
31
+ | 用户名 | 密码 | 角色 |
32
+ |--------|------|------|
33
+ | PS01 | admin_cybercity2025 | admin |
34
+ | PS02 | cybercity2025 | user |
35
+ | PS03 | cybercity2025 | user |
36
+ | PS04 | cybercity2025 | user |
37
+
38
+ #### 1.2 认证功能
39
+ - JWT token认证
40
+ - 登录失败锁定机制(5次失败锁定30分钟)
41
+ - 密码加密存储(bcrypt)
42
+ - 会话管理
43
+
44
+ ### 2. 数据存储架构
45
+
46
+ #### 2.1 临时数据库(内存)
47
+ - **存储介质**: Hugging Face Space内存
48
+ - **容量限制**: 最大12GB
49
+ - **数据类型**:
50
+ - 用户信息
51
+ - PPT编辑数据
52
+ - 导出的PPT页面截图
53
+ - 分享链接数据
54
+ - **自动保存**: 每10分钟自动保存修改的数据
55
+
56
+ #### 2.2 永久数据库(GitHub)
57
+ - **存储介质**: GitHub仓库
58
+ - **同步策略**: 每天03:00自动同步修改的数据
59
+ - **配置方式**: Space环境变量
60
+ - `GITHUB_TOKEN`: GitHub访问令牌
61
+ - `GITHUB_REPO`: 仓库地址(格式:owner/repo)
62
+ - **数据恢复**: Space重启时自动从GitHub同步数据
63
+
64
+ #### 2.3 数据同步规则
65
+ - **增量同步**: 仅同步修改的数据,未修改数据不同步
66
+ - **容量控制**: 同步数据量超过7GB时,仅同步最近的数据
67
+ - **按需加载**: 用户访问早期数据时,临时从GitHub拉取
68
+
69
+ ### 3. PPT分享功能
70
+
71
+ #### 3.1 分享机制
72
+ - 在前端PPT页面缩略图上添加分享按钮
73
+ - 点击按钮调用前端导出图片功能
74
+ - 导出JPEG格式截图
75
+ - 保存到内存临时数据库
76
+ - 生成永久唯一公网链接
77
+
78
+ #### 3.2 链接管理
79
+ - 链接是长期有效并且唯一的
80
+ - 链接格式:`/api/sharelink/{PPT的slideID}`
81
+ - 外网可通过链接直接访问图片
82
+ - 如果ppt修改,保存后将自动更新图片并按同样的流程上传内存数据库替换旧图片,外界通过这个链接读取更新的图片
83
+ - 访问日志记录
84
+
85
+ #### 3.3 自动更新
86
+ - PPT页面修改后,用户保存数据时自动重新生成截图
87
+ - 覆盖内存中的原截图
88
+ - 公网链接保持不变
89
+ - 外网访问获得更新后的页面
90
+
91
+ ### 4. 历史PPT管理
92
+
93
+ #### 4.1 管理界面
94
+ - 前端页面顶部添加历史PPT管理按钮
95
+ - 弹出历史PPT管理界面
96
+ - 支持分页显示(默认20条/页)
97
+ - 支持搜索和筛选功能
98
+
99
+ #### 4.2 数据加载策略
100
+ - 优先从内存数据库读取
101
+ - 内存中不存在需要的数据再从GitHub仓库拉取,这部分数据编辑后保存自动同步回内存数据库
102
+ - 支持按需加载早期数据
103
+ - 提供加载状态指示
104
+
105
+ #### 4.3 管理功能
106
+ - 查看PPT列表
107
+ - 打开历史PPT
108
+ - 复制PPT
109
+ - 删除PPT
110
+ - 导出PPT
111
+
112
+ ### 5. API接口设计
113
+
114
+ #### 5.1 认证接口
115
+ ```
116
+ POST /api/auth/login # 用户登录
117
+ GET /api/auth/verify # 验证token
118
+ POST /api/auth/logout # 用户登出
119
+ GET /api/auth/me # 获取用户信息
120
+ ```
121
+
122
+ #### 5.2 PPT管理接口
123
+ ```
124
+ POST /api/ppt/save # 保存PPT
125
+ PUT /api/ppt/:id # 更新PPT
126
+ GET /api/ppt/:id # 获取PPT详情
127
+ DELETE /api/ppt/:id # 删除PPT
128
+ GET /api/ppt # 获取PPT列表
129
+ POST /api/ppt/:id/copy # 复制PPT
130
+ ```
131
+
132
+ #### 5.3 分享接口
133
+ ```
134
+ POST /api/share/slide # 分享幻灯片
135
+ GET /api/share/view/:shareId # 查看分享截图
136
+ GET /api/share/info/:shareId # 获取分享信息
137
+ GET /api/share/my-shares # 获取我的分享
138
+ DELETE /api/share/:shareId # 删除分享
139
+ ```
140
+
141
+ #### 5.4 历史管理接口
142
+ ```
143
+ GET /api/history/ppts # 获取历史PPT列表
144
+ GET /api/history/ppts/:id/from-github # 从GitHub获取PPT
145
+ POST /api/history/search # 搜索历史PPT
146
+ GET /api/history/stats # 获取统计信息
147
+ ```
148
+
149
+ ### 6. 安全要求
150
+
151
+ #### 6.1 认证安全
152
+ - JWT token过期时间:24小时
153
+ - 密码加密:bcrypt(12轮)
154
+ - 登录失败锁定:5次失败锁定30分钟
155
+
156
+ #### 6.2 API安全
157
+ - 请求频率限制:100请求/15分钟
158
+ - CORS配置
159
+ - Helmet安全头
160
+ - 输入验证和清理
161
+
162
+ #### 6.3 数据安全
163
+ - 用户数据隔离
164
+ - 敏感信息不记录日志
165
+ - GitHub token安全存储
166
+
167
+ ### 7. 性能要求
168
+
169
+ #### 7.1 响应时间
170
+ - API响应时间 < 500ms
171
+ - 图片加载时间 < 2s
172
+ - PPT列表加载 < 1s
173
+
174
+ #### 7.2 并发处理
175
+ - 支持同时100个用户在线
176
+ - 数据库操作异步处理
177
+ - 图片压缩优化
178
+
179
+ #### 7.3 内存管理
180
+ - 内存使用监控
181
+ - 自动清理过期数据
182
+ - 数据压缩存储
183
+
184
+ ### 8. 监控和日志
185
+
186
+ #### 8.1 日志记录
187
+ - 用户操作日志
188
+ - 系统错误日志
189
+ - 性能监控日志
190
+ - GitHub同步日志
191
+
192
+ #### 8.2 健康检查
193
+ - 服务健康状态检查
194
+ - 数据库连接状态
195
+ - GitHub连接状态
196
+ - 内存使用情况
197
+
198
+ ### 9. 部署配置
199
+
200
+ #### 9.1 环境变量
201
+ ```bash
202
+ # 基础配置
203
+ PORT=5000
204
+ NODE_ENV=production
205
+
206
+ # GitHub配置
207
+ GITHUB_TOKEN=your-github-token
208
+ GITHUB_REPO=owner/repo-name
209
+ GITHUB_BRANCH=main
210
+
211
+ # 可选配置
212
+ MAX_MEMORY_GB=7
213
+ AUTO_SAVE_INTERVAL=10
214
+ SYNC_HOUR=0
215
+ ```
216
+
217
+ #### 9.2 Docker配置
218
+ - 基础镜像:node:18-alpine
219
+ - 工作目录:/app
220
+ - 数据目录:/app/data
221
+ - 健康检查:GET /health
222
+
223
+ ### 10. 维护和扩展
224
+
225
+ #### 10.1 数据备份
226
+ - 自动GitHub同步
227
+ - 手动备份功能
228
+ - 数据恢复机制
229
+
230
+ #### 10.2 系统维护
231
+ - 日志轮转
232
+ - 内存清理
233
+ - 性能优化
234
+
235
+ #### 10.3 功能扩展
236
+ - 支持更多用户
237
+ - 增加协作功能
238
+ - 优化存储策略
239
+
240
+ ## 项目结构
241
+
242
+ ```
243
+ backend/
244
+ ├── src/
245
+ │ ├── config/ # 配置文件
246
+ │ ├── middleware/ # 中间件
247
+ │ ├── routes/ # 路由
248
+ │ ├── services/ # 服务层
249
+ │ ├── types/ # 类型定义
250
+ │ ├── utils/ # 工具函数
251
+ │ └── index.ts # 入口文件
252
+ ├── data/ # 数据目录
253
+ ├── Dockerfile # Docker配置
254
+ ├── package.json # 依赖配置
255
+ ├── tsconfig.json # TypeScript配置
256
+ └── requirements.md # 需求文档
257
+ ```
258
+
259
+ ## 开发和测试
260
+
261
+ ### 开发环境
262
+ ```bash
263
+ npm install
264
+ npm run dev
265
+ ```
266
+
267
+ ### 生产构建
268
+ ```bash
269
+ npm run build
270
+ npm start
271
+ ```
272
+
273
+ ### 测试
274
+ ```bash
275
+ npm test
276
+ ```
277
+
278
+ ## 总结
279
+
280
+ 本后端系统为网页PPT应用提供完整的数据管理、用户认证、分享功能和历史记录管理。通过内存+GitHub的双重存储策略,确保数据的可靠性和访问性能。系统设计考虑了Hugging Face Space的特点和限制,提供了完整的解决方案。
shared/export-utils.js ADDED
@@ -0,0 +1,730 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // 前后端共享的PPT导出工具
2
+ // 可以在浏览器和Node.js环境中运行
3
+
4
+ export const generateSlideHTML = (pptData, slideIndex, options = {}) => {
5
+ const {
6
+ width = 1000,
7
+ height = 562,
8
+ includeInteractive = false,
9
+ format = 'view' // 'view' | 'export' | 'screenshot'
10
+ } = options;
11
+
12
+ const slide = pptData.slides[slideIndex];
13
+ if (!slide) {
14
+ throw new Error(`Slide ${slideIndex} not found`);
15
+ }
16
+
17
+ const theme = pptData.theme || {};
18
+
19
+ // 计算实际尺寸
20
+ const actualWidth = pptData.viewportSize || width;
21
+ const actualHeight = Math.ceil(actualWidth * (pptData.viewportRatio || 0.5625));
22
+
23
+ // 渲染元素
24
+ const renderElements = (elements) => {
25
+ if (!elements || elements.length === 0) return '';
26
+
27
+ return elements.map(element => {
28
+ const baseStyle = `
29
+ position: absolute;
30
+ left: ${element.left || 0}px;
31
+ top: ${element.top || 0}px;
32
+ width: ${element.width || 0}px;
33
+ height: ${element.height || 0}px;
34
+ z-index: ${element.zIndex || 1};
35
+ transform: rotate(${element.rotate || 0}deg);
36
+ `;
37
+
38
+ let content = '';
39
+ let specificStyles = '';
40
+
41
+ switch (element.type) {
42
+ case 'text':
43
+ const fontFamily = element.fontName || 'Microsoft YaHei';
44
+ const fontFallback = `${fontFamily}, 'Noto Sans SC', 'PingFang SC', 'Hiragino Sans GB', 'SimHei', 'SimSun', Arial, Helvetica, sans-serif`;
45
+
46
+ specificStyles = `
47
+ font-family: ${fontFallback};
48
+ font-size: ${element.fontSize || 14}px;
49
+ color: ${element.defaultColor || element.color || '#000'};
50
+ font-weight: ${element.bold ? 'bold' : 'normal'};
51
+ font-style: ${element.italic ? 'italic' : 'normal'};
52
+ text-decoration: ${element.underline ? 'underline' : 'none'};
53
+ text-align: ${element.align || 'left'};
54
+ line-height: ${element.lineHeight || 1.2};
55
+ padding: 10px;
56
+ word-wrap: break-word;
57
+ overflow: hidden;
58
+ box-sizing: border-box;
59
+ -webkit-font-smoothing: antialiased;
60
+ -moz-osx-font-smoothing: grayscale;
61
+ text-rendering: optimizeLegibility;
62
+ `;
63
+ content = element.content || '';
64
+ break;
65
+
66
+ case 'image':
67
+ specificStyles = `
68
+ background-image: url('${element.src}');
69
+ background-size: ${element.objectFit || 'cover'};
70
+ background-position: center;
71
+ background-repeat: no-repeat;
72
+ `;
73
+ break;
74
+
75
+ case 'shape':
76
+ specificStyles = `
77
+ background-color: ${element.fill || 'transparent'};
78
+ border: ${element.outline?.width || 0}px ${element.outline?.style || 'solid'} ${element.outline?.color || 'transparent'};
79
+ border-radius: ${element.shape === 'ellipse' ? '50%' : '0px'};
80
+ `;
81
+ break;
82
+ }
83
+
84
+ return `<div style="${baseStyle}${specificStyles}">${content}</div>`;
85
+ }).join('');
86
+ };
87
+
88
+ // 生成样式
89
+ const generateStyles = () => {
90
+ const baseStyles = `
91
+ * { box-sizing: border-box; margin: 0; padding: 0; }
92
+ body {
93
+ font-family: 'Microsoft YaHei', 'Noto Sans SC', 'PingFang SC', 'Hiragino Sans GB', 'SimHei', 'SimSun', Arial, Helvetica, sans-serif;
94
+ margin: 0;
95
+ padding: 0;
96
+ }
97
+ .slide-container {
98
+ position: relative;
99
+ width: ${actualWidth}px;
100
+ height: ${actualHeight}px;
101
+ background: ${slide.background?.color || theme.backgroundColor || '#ffffff'};
102
+ margin: 0 auto;
103
+ overflow: hidden;
104
+ }
105
+ `;
106
+
107
+ if (format === 'view') {
108
+ return baseStyles + `
109
+ html, body {
110
+ width: 100vw;
111
+ height: 100vh;
112
+ background: #000;
113
+ display: flex;
114
+ align-items: center;
115
+ justify-content: center;
116
+ overflow: hidden;
117
+ }
118
+ .slide-container {
119
+ transform-origin: center center;
120
+ }
121
+ `;
122
+ }
123
+
124
+ return baseStyles;
125
+ };
126
+
127
+ // 生成JavaScript(仅用于view模式)
128
+ const generateScript = () => {
129
+ if (format !== 'view') return '';
130
+
131
+ return `
132
+ <script>
133
+ function scalePPTToFitWindow() {
134
+ const container = document.querySelector('.slide-container');
135
+ if (!container) return;
136
+
137
+ const windowWidth = window.innerWidth;
138
+ const windowHeight = window.innerHeight;
139
+ const pptWidth = ${actualWidth};
140
+ const pptHeight = ${actualHeight};
141
+
142
+ const scaleX = windowWidth / pptWidth;
143
+ const scaleY = windowHeight / pptHeight;
144
+ const scale = Math.min(scaleX, scaleY, 1);
145
+
146
+ container.style.transform = 'scale(' + scale + ')';
147
+ }
148
+
149
+ window.addEventListener('load', scalePPTToFitWindow);
150
+ window.addEventListener('resize', scalePPTToFitWindow);
151
+ window.addEventListener('orientationchange', () => {
152
+ setTimeout(scalePPTToFitWindow, 100);
153
+ });
154
+ </script>
155
+ `;
156
+ };
157
+
158
+ return `<!DOCTYPE html>
159
+ <html lang="zh-CN">
160
+ <head>
161
+ <meta charset="UTF-8">
162
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
163
+ <title>${pptData.title || 'PPT'} - Page ${slideIndex + 1}</title>
164
+ <style>${generateStyles()}</style>
165
+ </head>
166
+ <body>
167
+ <div class="slide-container">
168
+ ${renderElements(slide.elements)}
169
+ </div>
170
+ ${generateScript()}
171
+ </body>
172
+ </html>`;
173
+ };
174
+
175
+ export const generateExportPage = (pptData, slideIndex, options = {}) => {
176
+ const {
177
+ format = 'jpeg',
178
+ quality = 90,
179
+ autoDownload = false
180
+ } = options;
181
+
182
+ const slideHTML = generateSlideHTML(pptData, slideIndex, {
183
+ ...options,
184
+ format: 'export'
185
+ });
186
+
187
+ // 提取slide-container内容
188
+ const slideContent = slideHTML.match(/<div class="slide-container">(.*?)<\/div>/s)?.[1] || '';
189
+
190
+ return `<!DOCTYPE html>
191
+ <html lang="zh-CN">
192
+ <head>
193
+ <meta charset="UTF-8">
194
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
195
+ <title>PPT Export - ${pptData.title}</title>
196
+ <style>
197
+ body {
198
+ margin: 0;
199
+ padding: 20px;
200
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
201
+ font-family: 'Microsoft YaHei', sans-serif;
202
+ min-height: 100vh;
203
+ display: flex;
204
+ flex-direction: column;
205
+ align-items: center;
206
+ justify-content: center;
207
+ }
208
+ .container {
209
+ background: white;
210
+ border-radius: 15px;
211
+ padding: 30px;
212
+ box-shadow: 0 20px 40px rgba(0,0,0,0.1);
213
+ text-align: center;
214
+ }
215
+ .slide-container {
216
+ position: relative;
217
+ width: ${pptData.viewportSize || 1000}px;
218
+ height: ${Math.ceil((pptData.viewportSize || 1000) * (pptData.viewportRatio || 0.5625))}px;
219
+ background: ${pptData.slides[slideIndex].background?.color || '#ffffff'};
220
+ margin: 20px auto;
221
+ overflow: hidden;
222
+ box-shadow: 0 4px 12px rgba(0,0,0,0.15);
223
+ border-radius: 4px;
224
+ }
225
+ .btn {
226
+ background: #4CAF50;
227
+ color: white;
228
+ border: none;
229
+ padding: 12px 24px;
230
+ border-radius: 5px;
231
+ cursor: pointer;
232
+ margin: 5px;
233
+ font-size: 16px;
234
+ font-weight: bold;
235
+ }
236
+ .btn:hover { background: #45a049; }
237
+ .btn:disabled { background: #cccccc; cursor: not-allowed; }
238
+ .status {
239
+ margin: 15px 0;
240
+ padding: 10px;
241
+ border-radius: 5px;
242
+ font-size: 14px;
243
+ }
244
+ .status.success { background: #e8f5e8; color: #2e7d32; }
245
+ .status.error { background: #fdeaea; color: #c62828; }
246
+ .status.info { background: #e3f2fd; color: #1565c0; }
247
+ </style>
248
+ </head>
249
+ <body>
250
+ <div class="container">
251
+ <h1>🚀 PPT Export</h1>
252
+ <p>${pptData.title} - Slide ${slideIndex + 1}</p>
253
+
254
+ <div class="slide-container" id="slideContainer">
255
+ ${slideContent}
256
+ </div>
257
+
258
+ <button class="btn" onclick="generateScreenshot()">📸 Generate Screenshot</button>
259
+ <button class="btn" onclick="downloadScreenshot()" id="downloadBtn" disabled>💾 Download</button>
260
+
261
+ <div id="status" class="status info">Ready to generate screenshot</div>
262
+ </div>
263
+
264
+ <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/html2canvas.min.js"></script>
265
+ <script>
266
+ let currentScreenshot = null;
267
+
268
+ async function generateScreenshot() {
269
+ try {
270
+ document.getElementById('status').textContent = 'Generating...';
271
+ document.getElementById('status').className = 'status info';
272
+
273
+ if (document.fonts && document.fonts.ready) {
274
+ await document.fonts.ready;
275
+ }
276
+ await new Promise(resolve => setTimeout(resolve, 300));
277
+
278
+ const canvas = await html2canvas(document.getElementById('slideContainer'), {
279
+ scale: 2,
280
+ useCORS: true,
281
+ allowTaint: true,
282
+ backgroundColor: null
283
+ });
284
+
285
+ currentScreenshot = canvas.toDataURL('image/${format}', ${quality / 100});
286
+
287
+ document.getElementById('status').textContent = 'Screenshot generated successfully!';
288
+ document.getElementById('status').className = 'status success';
289
+ document.getElementById('downloadBtn').disabled = false;
290
+
291
+ ${autoDownload ? 'downloadScreenshot();' : ''}
292
+
293
+ } catch (error) {
294
+ document.getElementById('status').textContent = 'Generation failed: ' + error.message;
295
+ document.getElementById('status').className = 'status error';
296
+ }
297
+ }
298
+
299
+ function downloadScreenshot() {
300
+ if (!currentScreenshot) return;
301
+
302
+ const link = document.createElement('a');
303
+ link.download = 'ppt-slide-${slideIndex + 1}.${format}';
304
+ link.href = currentScreenshot;
305
+ link.click();
306
+
307
+ document.getElementById('status').textContent = 'Downloaded successfully!';
308
+ document.getElementById('status').className = 'status success';
309
+ }
310
+
311
+ window.addEventListener('load', function() {
312
+ ${autoDownload ? 'setTimeout(generateScreenshot, 500);' : ''}
313
+ });
314
+ </script>
315
+ </body>
316
+ </html>`;
317
+ };
318
+
319
+ // 新增:前端导出功能的服务器端实现
320
+ export const exportPPTToJSON = (pptData) => {
321
+ return {
322
+ title: pptData.title,
323
+ width: pptData.viewportSize || 1000,
324
+ height: Math.ceil((pptData.viewportSize || 1000) * (pptData.viewportRatio || 0.5625)),
325
+ theme: pptData.theme,
326
+ slides: pptData.slides,
327
+ exportedAt: new Date().toISOString(),
328
+ format: 'json',
329
+ version: '1.0'
330
+ };
331
+ };
332
+
333
+ // 新增:生成完整的HTML演示文稿
334
+ export const generateHTMLPresentation = (pptData, options = {}) => {
335
+ const {
336
+ includeInteractivity = true,
337
+ standalone = true,
338
+ includeCSS = true
339
+ } = options;
340
+
341
+ const viewportSize = pptData.viewportSize || 1000;
342
+ const viewportRatio = pptData.viewportRatio || 0.5625;
343
+ const slideHeight = Math.round(viewportSize * viewportRatio);
344
+ const theme = pptData.theme || {};
345
+
346
+ // CSS样式
347
+ const css = includeCSS ? `
348
+ <style>
349
+ * {
350
+ margin: 0;
351
+ padding: 0;
352
+ box-sizing: border-box;
353
+ }
354
+
355
+ body {
356
+ font-family: '${theme.fontName || 'Microsoft YaHei'}', 'Microsoft YaHei', Arial, sans-serif;
357
+ background: ${theme.backgroundColor || '#000'};
358
+ color: ${theme.fontColor || '#333'};
359
+ overflow: hidden;
360
+ }
361
+
362
+ .presentation-container {
363
+ width: 100vw;
364
+ height: 100vh;
365
+ display: flex;
366
+ justify-content: center;
367
+ align-items: center;
368
+ background: #000;
369
+ }
370
+
371
+ .slide-container {
372
+ width: ${viewportSize}px;
373
+ height: ${slideHeight}px;
374
+ background: #fff;
375
+ position: relative;
376
+ overflow: hidden;
377
+ transform-origin: center;
378
+ box-shadow: 0 8px 32px rgba(0,0,0,0.3);
379
+ }
380
+
381
+ .slide {
382
+ width: 100%;
383
+ height: 100%;
384
+ position: absolute;
385
+ top: 0;
386
+ left: 0;
387
+ display: none;
388
+ }
389
+
390
+ .slide.active {
391
+ display: block;
392
+ }
393
+
394
+ .element {
395
+ position: absolute;
396
+ word-wrap: break-word;
397
+ }
398
+
399
+ .text-element {
400
+ display: flex;
401
+ align-items: center;
402
+ justify-content: center;
403
+ text-align: center;
404
+ }
405
+
406
+ .image-element img {
407
+ width: 100%;
408
+ height: 100%;
409
+ object-fit: contain;
410
+ }
411
+
412
+ .shape-element {
413
+ border-radius: var(--border-radius, 0);
414
+ }
415
+
416
+ .navigation {
417
+ position: fixed;
418
+ bottom: 30px;
419
+ left: 50%;
420
+ transform: translateX(-50%);
421
+ display: flex;
422
+ gap: 10px;
423
+ z-index: 1000;
424
+ }
425
+
426
+ .nav-btn {
427
+ padding: 12px 20px;
428
+ background: rgba(255,255,255,0.9);
429
+ border: none;
430
+ border-radius: 25px;
431
+ cursor: pointer;
432
+ font-size: 14px;
433
+ font-weight: bold;
434
+ transition: all 0.3s ease;
435
+ box-shadow: 0 4px 15px rgba(0,0,0,0.2);
436
+ }
437
+
438
+ .nav-btn:hover {
439
+ background: rgba(255,255,255,1);
440
+ transform: translateY(-2px);
441
+ }
442
+
443
+ .nav-btn:disabled {
444
+ opacity: 0.5;
445
+ cursor: not-allowed;
446
+ }
447
+
448
+ .slide-counter {
449
+ position: fixed;
450
+ top: 30px;
451
+ right: 30px;
452
+ background: rgba(0,0,0,0.7);
453
+ color: white;
454
+ padding: 8px 16px;
455
+ border-radius: 20px;
456
+ font-size: 14px;
457
+ z-index: 1000;
458
+ }
459
+
460
+ .fullscreen-btn {
461
+ position: fixed;
462
+ top: 30px;
463
+ left: 30px;
464
+ background: rgba(0,0,0,0.7);
465
+ color: white;
466
+ border: none;
467
+ padding: 8px 16px;
468
+ border-radius: 20px;
469
+ cursor: pointer;
470
+ font-size: 14px;
471
+ z-index: 1000;
472
+ }
473
+
474
+ /* 响应式缩放 */
475
+ @media (max-width: 1200px) {
476
+ .slide-container {
477
+ transform: scale(0.8);
478
+ }
479
+ }
480
+
481
+ @media (max-width: 800px) {
482
+ .slide-container {
483
+ transform: scale(0.6);
484
+ }
485
+ }
486
+
487
+ @media (max-width: 600px) {
488
+ .slide-container {
489
+ transform: scale(0.4);
490
+ }
491
+ }
492
+ </style>
493
+ ` : '';
494
+
495
+ // JavaScript交互功能
496
+ const javascript = includeInteractivity ? `
497
+ <script>
498
+ class PPTViewer {
499
+ constructor() {
500
+ this.currentSlide = 0;
501
+ this.totalSlides = ${pptData.slides.length};
502
+ this.init();
503
+ }
504
+
505
+ init() {
506
+ this.updateSlide();
507
+ this.bindEvents();
508
+ this.autoScale();
509
+ window.addEventListener('resize', () => this.autoScale());
510
+ }
511
+
512
+ bindEvents() {
513
+ document.addEventListener('keydown', (e) => {
514
+ switch(e.key) {
515
+ case 'ArrowLeft':
516
+ case 'ArrowUp':
517
+ this.prevSlide();
518
+ break;
519
+ case 'ArrowRight':
520
+ case 'ArrowDown':
521
+ case ' ':
522
+ this.nextSlide();
523
+ break;
524
+ case 'Home':
525
+ this.goToSlide(0);
526
+ break;
527
+ case 'End':
528
+ this.goToSlide(this.totalSlides - 1);
529
+ break;
530
+ case 'F11':
531
+ this.toggleFullscreen();
532
+ break;
533
+ }
534
+ });
535
+ }
536
+
537
+ nextSlide() {
538
+ if (this.currentSlide < this.totalSlides - 1) {
539
+ this.currentSlide++;
540
+ this.updateSlide();
541
+ }
542
+ }
543
+
544
+ prevSlide() {
545
+ if (this.currentSlide > 0) {
546
+ this.currentSlide--;
547
+ this.updateSlide();
548
+ }
549
+ }
550
+
551
+ goToSlide(index) {
552
+ if (index >= 0 && index < this.totalSlides) {
553
+ this.currentSlide = index;
554
+ this.updateSlide();
555
+ }
556
+ }
557
+
558
+ updateSlide() {
559
+ document.querySelectorAll('.slide').forEach(slide => {
560
+ slide.classList.remove('active');
561
+ });
562
+
563
+ const currentSlideEl = document.getElementById('slide-' + this.currentSlide);
564
+ if (currentSlideEl) {
565
+ currentSlideEl.classList.add('active');
566
+ }
567
+
568
+ const counter = document.querySelector('.slide-counter');
569
+ if (counter) {
570
+ counter.textContent = \`\${this.currentSlide + 1} / \${this.totalSlides}\`;
571
+ }
572
+
573
+ const prevBtn = document.getElementById('prevBtn');
574
+ const nextBtn = document.getElementById('nextBtn');
575
+ if (prevBtn) prevBtn.disabled = this.currentSlide === 0;
576
+ if (nextBtn) nextBtn.disabled = this.currentSlide === this.totalSlides - 1;
577
+ }
578
+
579
+ autoScale() {
580
+ const container = document.querySelector('.slide-container');
581
+ if (!container) return;
582
+
583
+ const windowWidth = window.innerWidth;
584
+ const windowHeight = window.innerHeight;
585
+ const slideWidth = ${viewportSize};
586
+ const slideHeight = ${slideHeight};
587
+
588
+ const scaleX = (windowWidth * 0.9) / slideWidth;
589
+ const scaleY = (windowHeight * 0.9) / slideHeight;
590
+ const scale = Math.min(scaleX, scaleY, 1);
591
+
592
+ container.style.transform = \`scale(\${scale})\`;
593
+ }
594
+
595
+ toggleFullscreen() {
596
+ if (!document.fullscreenElement) {
597
+ document.documentElement.requestFullscreen();
598
+ } else {
599
+ document.exitFullscreen();
600
+ }
601
+ }
602
+ }
603
+
604
+ // 初始化PPT查看器
605
+ document.addEventListener('DOMContentLoaded', () => {
606
+ window.pptViewer = new PPTViewer();
607
+ });
608
+ </script>
609
+ ` : '';
610
+
611
+ // 格式化幻灯片背景
612
+ const formatSlideBackground = (background) => {
613
+ if (!background) return 'background: #ffffff;';
614
+
615
+ if (background.type === 'solid') {
616
+ return `background: ${background.color || '#ffffff'};`;
617
+ }
618
+
619
+ if (background.type === 'gradient') {
620
+ const { gradientType, colors } = background;
621
+ if (gradientType === 'linear') {
622
+ return `background: linear-gradient(${background.gradientRotate || 0}deg, ${colors.map(c => c.color).join(', ')});`;
623
+ }
624
+ return `background: radial-gradient(${colors.map(c => c.color).join(', ')});`;
625
+ }
626
+
627
+ if (background.type === 'image' && background.image) {
628
+ return `background-image: url(${background.image.src}); background-size: cover; background-position: center;`;
629
+ }
630
+
631
+ return 'background: #ffffff;';
632
+ };
633
+
634
+ // 格式化元素
635
+ const formatElement = (element) => {
636
+ const baseStyle = `
637
+ left: ${element.left || 0}px;
638
+ top: ${element.top || 0}px;
639
+ width: ${element.width || 100}px;
640
+ height: ${element.height || 100}px;
641
+ transform: rotate(${element.rotate || 0}deg);
642
+ `;
643
+
644
+ if (element.type === 'text') {
645
+ const fontFamily = element.fontName || 'Microsoft YaHei';
646
+ const fontFallback = `${fontFamily}, 'Noto Sans SC', 'PingFang SC', 'Hiragino Sans GB', 'SimHei', 'SimSun', Arial, Helvetica, sans-serif`;
647
+
648
+ const textStyle = `
649
+ font-size: ${element.fontSize || 16}px;
650
+ font-family: ${fontFallback};
651
+ color: ${element.defaultColor || element.color || '#000000'};
652
+ font-weight: ${element.bold ? 'bold' : 'normal'};
653
+ font-style: ${element.italic ? 'italic' : 'normal'};
654
+ text-decoration: ${element.underline ? 'underline' : 'none'};
655
+ text-align: ${element.align || 'left'};
656
+ line-height: ${element.lineHeight || 1.5};
657
+ padding: 10px;
658
+ word-wrap: break-word;
659
+ overflow: hidden;
660
+ box-sizing: border-box;
661
+ -webkit-font-smoothing: antialiased;
662
+ -moz-osx-font-smoothing: grayscale;
663
+ text-rendering: optimizeLegibility;
664
+ `;
665
+
666
+ return `<div class="element text-element" style="${baseStyle}${textStyle}">${element.content || ''}</div>`;
667
+ }
668
+
669
+ if (element.type === 'image' && element.src) {
670
+ return `<div class="element image-element" style="${baseStyle}"><img src="${element.src}" alt="图片" /></div>`;
671
+ }
672
+
673
+ if (element.type === 'shape') {
674
+ const shapeStyle = `
675
+ background: ${element.fill || '#ffffff'};
676
+ border: ${element.outline?.width || 0}px solid ${element.outline?.color || '#000000'};
677
+ border-radius: ${element.borderRadius || 0}px;
678
+ `;
679
+
680
+ return `<div class="element shape-element" style="${baseStyle}${shapeStyle}"></div>`;
681
+ }
682
+
683
+ // 其他元素类型的基本处理
684
+ return `<div class="element" style="${baseStyle}"></div>`;
685
+ };
686
+
687
+ // 生成幻灯片HTML
688
+ const slidesHTML = pptData.slides.map((slide, index) => {
689
+ const slideBackground = formatSlideBackground(slide.background);
690
+ const elementsHTML = slide.elements.map(element => formatElement(element)).join('');
691
+
692
+ return `
693
+ <div id="slide-${index}" class="slide ${index === 0 ? 'active' : ''}" style="${slideBackground}">
694
+ ${elementsHTML}
695
+ </div>
696
+ `;
697
+ }).join('');
698
+
699
+ // 导航控件HTML
700
+ const navigationHTML = includeInteractivity ? `
701
+ <div class="navigation">
702
+ <button id="prevBtn" class="nav-btn" onclick="window.pptViewer?.prevSlide()">上一页</button>
703
+ <button id="nextBtn" class="nav-btn" onclick="window.pptViewer?.nextSlide()">下一页</button>
704
+ </div>
705
+ <div class="slide-counter">1 / ${pptData.slides.length}</div>
706
+ <button class="fullscreen-btn" onclick="window.pptViewer?.toggleFullscreen()">全屏</button>
707
+ ` : '';
708
+
709
+ // 组装完整HTML
710
+ return `<!DOCTYPE html>
711
+ <html lang="zh-CN">
712
+ <head>
713
+ <meta charset="UTF-8">
714
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
715
+ <title>${pptData.title}</title>
716
+ <meta name="description" content="PPTist导出的HTML演示文稿">
717
+ <meta name="generator" content="PPTist">
718
+ ${css}
719
+ </head>
720
+ <body>
721
+ <div class="presentation-container">
722
+ <div class="slide-container">
723
+ ${slidesHTML}
724
+ </div>
725
+ </div>
726
+ ${navigationHTML}
727
+ ${javascript}
728
+ </body>
729
+ </html>`;
730
+ };
shared/package.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "type": "module",
3
+ "name": "shared-export-utils",
4
+ "version": "1.0.0",
5
+ "description": "Shared export utilities for PPTist frontend and backend"
6
+ }