dsh-ppt 0.18.3 → 0.19.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/README.en.md +7 -6
- package/README.md +3 -2
- package/docs/VALIDATION.md +2 -0
- package/docs/WORKBENCH.md +12 -0
- package/docs/validation-0.19.0.md +11 -0
- package/lib/client.js +5 -2
- package/lib/workbench-language.js +1 -0
- package/lib/workbench.js +34 -13
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,17 @@
|
|
|
4
4
|
|
|
5
5
|
[历史英文记录](docs/CHANGELOG.en.md)
|
|
6
6
|
|
|
7
|
+
## 0.19.1 (2026-10-29)
|
|
8
|
+
|
|
9
|
+
- 同步仓库与 npm 的简明介绍、中英文 README 和反馈入口;本次为文档与包元数据更新。
|
|
10
|
+
- Sync npm descriptions and both README guides with the repository, including issue and pull-request links.
|
|
11
|
+
|
|
12
|
+
## 0.19.0 (2026-10-28)
|
|
13
|
+
|
|
14
|
+
- 下载面板区分分享成品包与完整工程包。分享包包含当前 PPTX、离线 HTML 和逐页讲稿,不打包 JSON 工程;工程备份入口继续保留。
|
|
15
|
+
- 分享 HTML 移除缺失工程文件的下载入口;不覆盖原文件,沿用修订校验与未保存保护,下载无需调用模型。
|
|
16
|
+
- Add separate share and project bundles, with current speaker notes and clear content boundaries. Preserve revision guards and original files; ordinary downloads require no model calls.
|
|
17
|
+
|
|
7
18
|
## 0.18.3 (2026-10-27)
|
|
8
19
|
|
|
9
20
|
- 修复分批更新时的新旧更新控件混用:保留原页面、草稿与安装保护,空闲后接管旧控制器,兼容旧入口。
|
package/README.en.md
CHANGED
|
@@ -1,28 +1,29 @@
|
|
|
1
1
|
# dsh-ppt
|
|
2
2
|
|
|
3
|
-
Optional **visual review and repair** inspects images rendered from the actual PPTX, highlights problem regions, creates a formatting-only copy and renders it again for rechecking. The original stays intact. See [visual review](docs/VISUAL.md#english).
|
|
4
|
-
|
|
5
3
|
[中文](README.md)
|
|
6
4
|
|
|
7
5
|

|
|
8
6
|
|
|
9
|
-
Turn source material into
|
|
10
|
-
|
|
11
|
-
Optional **AI review** and **rehearsal** reuse models configured in DSH. Both are off by default: download the finished presentation directly, or explicitly start a bounded rehearsal. Compare proposed wording edits, save selected changes and backup Q&A slides to an undoable copy, and export Q&A with an evidence checklist. See [the rehearsal guide](docs/COACHING.md#english). AI suggestions are not fact checks.
|
|
7
|
+
Turn source material into a finished HTML slideshow, editable PPTX and reusable project bundle. Edit in DSH, trace numeric sources and explore live scenarios; AI review, rehearsal and visual repair are optional, so you can download the finished deck directly.
|
|
12
8
|
|
|
13
9
|
[](https://www.npmjs.com/package/dsh-ppt) [](https://www.npmjs.com/package/dsh-ppt)
|
|
14
10
|
|
|
15
11
|
Feedback and contributions are welcome: report [issues](https://github.com/STARDUSTLC666/dsh-ppt/issues) or submit [pull requests](https://github.com/STARDUSTLC666/dsh-ppt/pulls).
|
|
16
12
|
|
|
17
|
-
Open the
|
|
13
|
+
Open the workbench from the native DSH sidebar. See the [workbench guide](docs/WORKBENCH.md) for configuration and operating boundaries.
|
|
18
14
|
|
|
19
15
|
## What it does
|
|
20
16
|
|
|
17
|
+
Optional **visual review and repair** inspects images rendered from the actual PPTX, highlights problem regions, creates a formatting-only copy and renders it again for rechecking. The original stays intact. See [visual review](docs/VISUAL.md#english).
|
|
18
|
+
|
|
19
|
+
Optional **AI review** and **rehearsal** reuse models configured in DSH. Both are off by default: download the finished presentation directly, or explicitly start a bounded rehearsal. Compare proposed wording edits, save selected changes and backup Q&A slides to an undoable copy, and export Q&A with an evidence checklist. See [the rehearsal guide](docs/COACHING.md#english). AI suggestions are not fact checks.
|
|
20
|
+
|
|
21
21
|
- Create branded decks with text, images, tables and native charts.
|
|
22
22
|
- Optionally trace numbers to material, CSV cells or formulas; adjust assumptions, preview affected slides, and save an undoable copy. HTML stays interactive; PPTX includes confirmed static values with formulas and assumptions. See the [data guide](docs/DATA.md#english).
|
|
23
23
|
- Edit text and images in Settings, reorder, duplicate or delete slides, and undo changes.
|
|
24
24
|
- Check quality and optionally render the final PPTX as images or PDF.
|
|
25
25
|
- Download Markdown speaker notes with each slide's current title and notes.
|
|
26
|
+
- Choose a share bundle (PPTX, offline HTML and current speaker notes) or a project bundle (including the editable JSON). Share bundles retain bound source excerpts and authored content. See [download details](docs/WORKBENCH.md#下载与分享--download-and-share).
|
|
26
27
|
- Keyboard support: Ctrl/⌘+S save, Esc cancel or go back, Alt+←/→ switch slides; leaving with unsaved edits prompts first.
|
|
27
28
|
|
|
28
29
|
## Install
|
package/README.md
CHANGED
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
|
|
5
5
|

|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
把材料制作成可直接交付的 HTML 放映、可编辑 PPTX 与工程包。可在 DSH 工作台轻量编辑、核对数字来源和现场推演;AI 预审、模拟答辩与看图修复均按需选择,也可直接下载成品。
|
|
8
8
|
|
|
9
9
|
[](https://www.npmjs.com/package/dsh-ppt) [](https://www.npmjs.com/package/dsh-ppt)
|
|
10
10
|
|
|
11
11
|
欢迎使用,遇到问题或有改进建议,请提交 [issues](https://github.com/STARDUSTLC666/dsh-ppt/issues) 和 [PR](https://github.com/STARDUSTLC666/dsh-ppt/pulls)。
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
从 DSH 原生侧栏打开工作台;配置与操作边界见[工作台说明](docs/WORKBENCH.md)。
|
|
14
14
|
|
|
15
15
|
## 功能
|
|
16
16
|
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
- 提供质量检查与可选的最终 PPTX 图片 / PDF 渲染。
|
|
21
21
|
- 可选 AI 视觉检查:看实际 PPTX 图片,标记问题区域,调整排版并另存副本,重新渲染复查;支持前后对比、停止、撤销与检查记录。见[看图修复](docs/VISUAL.md)。
|
|
22
22
|
- 下载按页整理的 Markdown 讲稿,保留当前版本的标题与演讲备注。
|
|
23
|
+
- 下载时可选「分享成品包」(PPTX、离线 HTML、当前讲稿)或「完整工程包」(含 JSON 工程)。分享包仍保留已绑定的来源摘录与用户填写内容,详见[下载说明](docs/WORKBENCH.md#下载与分享--download-and-share)。
|
|
23
24
|
- 可选 AI 预审与模拟答辩:复用 DSH 已配置模型,按需提问、比较改稿、另存可撤销副本,并导出问答与待补充材料清单。默认关闭,直接下载成品无需预审。
|
|
24
25
|
- 键盘操作:Ctrl/⌘+S 保存、Esc 取消或返回、Alt+←/→ 切换页面;有未保存修改时离开会提示。
|
|
25
26
|
|
package/docs/VALIDATION.md
CHANGED
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
|
|
7
7
|
## 最新记录
|
|
8
8
|
|
|
9
|
+
[0.19.0 分享成品包验收](validation-0.19.0.md):208 项 Windows 测试、官方 DSH Web 实际保存与两种 ZIP 下载、离线 HTML、三页最终 PPTX 原生渲染及逐页目视检查、中英文与深色窄屏。Electron 专属行为与真实 Office 应用本轮未测。
|
|
10
|
+
|
|
9
11
|
[0.16.0 看图检查与排版修复验收](validation-0.16.0.md):200 项测试、真实 DSH 图片与模型接口、实际模型样例、修复副本复查、中文操作与英文深色窄屏、官方 CLI 全新安装。AI 检查结果与人工 / 桌面原生验收分开记录。
|
|
10
12
|
|
|
11
13
|
[0.15.0 数字溯源与推演验收](validation-0.15.0.md):自动测试、真实 DSH Web / 离线 HTML 操作、来源更新、参数回存、复制撤销、四页最终 PPTX 原生渲染及画面核对。桌面原生窗口内逐项操作另行验收。
|
package/docs/WORKBENCH.md
CHANGED
|
@@ -14,6 +14,18 @@ Update the plugin, restart DSH and open its native sidebar panel (or More if it
|
|
|
14
14
|
|
|
15
15
|
The UI follows host language and theme without translating user content. Narrow master/detail views have a Back action; editors adapt their columns to available space. Destructive actions require confirmation and edits are protected.
|
|
16
16
|
|
|
17
|
+
## 下载与分享 / Download and share
|
|
18
|
+
|
|
19
|
+
在项目右上角点击「下载成品」。先保存修改,再选择需要的文件:
|
|
20
|
+
|
|
21
|
+
- **分享成品包 ZIP**:当前 PPTX、可离线放映的 HTML、逐页 Markdown 讲稿与使用说明;不含 JSON 工程和完整导入材料。分享版 HTML 保留 PPTX 下载入口,移除工程下载入口。原文件不会改变。
|
|
22
|
+
- **完整工程包 ZIP**:PPTX、HTML、JSON 工程与使用说明,方便备份或继续编辑。JSON 可能含完整导入材料。
|
|
23
|
+
- 也可分别下载 PPTX、HTML、讲稿或工程。未保存时先保存,旧修订的下载会被拒绝。
|
|
24
|
+
|
|
25
|
+
分享包里的 HTML、PPTX 备注和讲稿仍保留已绑定的来源摘录与用户填写内容。分包不等于自动脱敏,请按收件人需要选择内容。
|
|
26
|
+
|
|
27
|
+
Open **Download output** and save edits first. **Share bundle ZIP** contains the current PPTX, offline HTML, Markdown speaker notes and instructions; it omits the project JSON and complete imported materials. **Project bundle ZIP** includes the editable JSON for backup. Original files are preserved. Share output still contains bound source excerpts and authored notes. These downloads never require AI review or a model call.
|
|
28
|
+
|
|
17
29
|
## 源码 / Source
|
|
18
30
|
|
|
19
31
|
编辑 templates/client.js、templates/panels/*.js 与 templates/workbench-ui.js,运行 pnpm run build。lib/client.js 是确定性产物,请随源码提交。公共组件的规范源位于 dsh-suite/ui/workbench-ui.js,Suite 的同步脚本显式分发副本;单个仓库可独立构建和安装。
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# 0.19.0 分享成品包验收
|
|
2
|
+
|
|
3
|
+
2026-10-28,Windows,Node 24.16,官方 DSH 0.2.1-rc.3 Web,后台 Chrome / Playwright。Browser plugin 不可用,因此使用本地 Playwright,不切换用户前台窗口。
|
|
4
|
+
|
|
5
|
+
- 208 项测试通过,包括旧修订拒绝、原文件字节不变、工程/分享包内容边界、最新讲稿、异常 HTML 拒绝与零模型调用。
|
|
6
|
+
- 真实工作台编辑讲稿、保存,未保存时下载按钮禁用。原生认证下载路由分别下载分享 ZIP 与工程 ZIP,确认均为修订 1,PPTX 字节与保存结果一致。
|
|
7
|
+
- 分享 ZIP 恰含 PPTX、HTML、Markdown 与 README;工程 ZIP 保留 JSON。分享 HTML 离线打开并切页,移除 JSON 下载入口,PPTX 下载入口保留。
|
|
8
|
+
- 中文浅色、英文深色、390px 窄屏实际点击与截图检查,弹窗未越出视口,用户内容保持原文。
|
|
9
|
+
- 下载得到的三页 PPTX 用官方 LibreOffice Kit 0.1.5 原生后端渲染,逐页查看 PNG,未发现缺字或溢出;引擎未报告缺失字体。
|
|
10
|
+
|
|
11
|
+
未测试:Electron 专属窗口/菜单、真实 PowerPoint/WPS 手工编辑、全部主题与输入组合。此次下载流程无需真实模型,未调用付费模型。
|
package/lib/client.js
CHANGED
|
@@ -1655,7 +1655,10 @@ h('button', { disabled: busy || dirty || imagePending || dataDirty || !project.u
|
|
|
1655
1655
|
h('section',{className:'ppt-inspector-panel',hidden:activeTab!=='data'},project.dataModel?project.dataModel && h(DataPanel, { key: project.id + ':' + project.revision, project, blocked: busy || dirty || imagePending || mode !== 'html', incoming: incomingData,
|
|
1656
1656
|
onParameters: parameters => frame.current?.contentWindow?.postMessage({ type: 'dsh-ppt-data-set', nonce: nonce.current, parameters, command: ++dataCommand.current }, '*'), onDirty: setDataDirty, onBusy: value => { setBusy(value); setJob(languageOf() === 'en' ? 'Updating presentation data…' : '正在核对并更新数据…'); },
|
|
1657
1657
|
onAdopt: next => { adopt(next, selected); setMessage(languageOf() === 'en' ? 'Saved confirmed data. HTML, PPTX and project are synchronized; undo is available.' : '已保存确认后的数据,HTML、PPTX 和工程已同步,可撤销。'); }, onChoose: id => choose(project.slides.find(s => s.id === id)), onDownload: download }):h(W.Empty,{title:pptText('此工程没有绑定数据模型','This project has no bound data model'),icon:'file'},pptText('生成时提供来源、指标和可调假设后,可在这里核对来源并预览推演影响。普通演示文稿仍可正常编辑和下载。','Provide sources, metrics and adjustable assumptions when generating the deck to inspect lineage and scenario changes here. Normal editing and downloads remain available.')))))),
|
|
1658
|
-
downloadOpen && project ? h(W.Dialog,{title:pptText('下载成品','Download output'),closeLabel:pptText('关闭','Close'),onClose:()=>setDownloadOpen(false)},h('div',{className:'ppt-downloads'},
|
|
1658
|
+
downloadOpen && project ? h(W.Dialog,{title:pptText('下载成品','Download output'),closeLabel:pptText('关闭','Close'),onClose:()=>setDownloadOpen(false)},h('div',{className:'ppt-downloads'},
|
|
1659
|
+
h('p',{className:'muted'},pptText('分享包包含 PPTX、HTML 和讲稿,不含工程 JSON;工程包保留完整编辑资料。请先保存修改,再下载最新版本。','The share bundle contains PPTX, HTML and speaker notes, without the project JSON. The project bundle keeps full editing data. Save edits before downloading.')),
|
|
1660
|
+
h('p',{className:'muted'},pptText('HTML、PPTX 备注和讲稿保留已绑定的来源摘录与用户填写内容。','HTML, PPTX notes and speaker notes retain bound source excerpts and authored content.')),
|
|
1661
|
+
h('div', { className: 'tools' }, h('button', { className: 'primary', disabled: busy || dirty || imagePending || dataDirty, onClick: () => download('share') }, pptText('下载分享成品包 ZIP','Download share bundle ZIP')),h('button',{disabled:busy || dirty || imagePending || dataDirty,onClick:()=>download('bundle')},pptText('下载完整工程包 ZIP','Download project bundle ZIP')), h('button', { disabled: busy || dirty || imagePending || dataDirty, onClick: () => download('pptx') }, t("下载最新 PPTX")), h('button', { disabled: busy || dirty || imagePending || dataDirty, onClick: () => download('html') }, t("下载 HTML")), h('button', { disabled: busy || dirty || imagePending || dataDirty, onClick: () => download('notes') }, t("下载讲稿 Markdown")), h('button', { disabled: busy || dirty || imagePending || dataDirty, onClick: () => download('json') }, t("备份工程"))))) : null,
|
|
1659
1662
|
pendingNav ? h(W.Dialog,{title:pptText('有未保存的修改','Unsaved changes'),closeLabel:pptText('继续编辑','Keep editing'),busy,onClose:()=>setPendingNav(null)},h('p',null,pptText('请选择如何处理当前页的修改。','Choose what to do with the current slide edits.')),h(W.Status,{tone:'error'},error),h('div',{className:'w-toolbar'},h(W.Button,{variant:'primary',disabled:busy || imagePending || dataDirty,onClick:async()=>{const target=pendingNav;const result=await save();if(result?.project && alive.current)finishNavigation(target,result.project);}},pptText('保存后继续','Save and continue')),h(W.Button,{disabled:busy,onClick:()=>finishNavigation(pendingNav)},pptText('放弃修改并继续','Discard and continue')),h(W.Button,{disabled:busy,onClick:()=>setPendingNav(null)},pptText('继续编辑','Keep editing')))) : null,
|
|
1660
1663
|
deleteOpen && project ? h(W.Dialog,{title:t('删除本页'),closeLabel:pptText('取消','Cancel'),busy,onClose:()=>setDeleteOpen(false)},h('p',null,pptText('将删除当前页面,之后可以撤销。','Remove the current slide. You can undo this change.')),h(W.Status,{tone:'error'},error),h('div',{className:'w-toolbar'},h(W.Button,{variant:'danger',disabled:busy,onClick:async()=>{const result=await structure('remove');if(result)setDeleteOpen(false);}},pptText('确认删除本页','Confirm remove slide')),h(W.Button,{disabled:busy,onClick:()=>setDeleteOpen(false)},pptText('取消','Cancel')))) : null),"dsh-ppt");
|
|
1661
1664
|
}
|
|
@@ -1671,7 +1674,7 @@ W.register(ctx,{id:'dsh-ppt.workbench',label:()=>t('演示文稿'),icon:'slides'
|
|
|
1671
1674
|
ctx.slots.inject('settings.section', () => ctx.slots.register({ name: 'settings.section', id: 'dsh-ppt', order: 58, label: () => t("演示文稿"), inject: () => ({ locale: localeService }) }, Workbench));
|
|
1672
1675
|
}
|
|
1673
1676
|
return { inject: ['slots', 'locale'], apply, __internals: { draftFor, editorHtml, createImageLoader, modelRouteKey, findModelRoute, reconcileModelRoute } };
|
|
1674
|
-
} },{"name":"dsh-ppt","version":"0.1.0","hasWorkbench":true,"packageVersion":"0.
|
|
1677
|
+
} },{"name":"dsh-ppt","version":"0.1.0","hasWorkbench":true,"packageVersion":"0.19.1","label":"演示文稿","labelEn":"PPT","suiteComponent":true}));
|
|
1675
1678
|
|
|
1676
1679
|
})();
|
|
1677
1680
|
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
const messages = {
|
|
3
3
|
'成品文件不完整,请先保存一次再下载成品包': 'The delivery files are incomplete. Save this presentation before downloading the bundle.',
|
|
4
4
|
'成品包超过 128 MiB,请分别下载文件': 'The delivery bundle exceeds 128 MiB. Download the files separately.',
|
|
5
|
+
'HTML 工程下载入口异常,请保存副本后重试': 'The HTML project download control is invalid. Save a copy and retry.',
|
|
5
6
|
'文件不是普通文件或超过 64 MiB': 'The file is not a regular file or exceeds 64 MiB.',
|
|
6
7
|
'项目索引超过 8 MiB,请备份后整理 projects.jsonl': 'The project index exceeds 8 MiB. Back it up before reviewing projects.jsonl.',
|
|
7
8
|
'项目索引已满,请备份后整理 projects.jsonl': 'The project index is full. Back it up before reviewing projects.jsonl.',
|
package/lib/workbench.js
CHANGED
|
@@ -13,6 +13,17 @@ export const PPT_DOWNLOAD_ROUTE = '/api/dsh-ppt/download';
|
|
|
13
13
|
const REQUEST_LIMIT = 12 * 1024 * 1024;
|
|
14
14
|
const FILE_LIMIT = 64 * 1024 * 1024;
|
|
15
15
|
const BUNDLE_LIMIT = 128 * 1024 * 1024;
|
|
16
|
+
/** Sharing keeps the offline deck, but omits the control for a project not in the ZIP. */
|
|
17
|
+
function shareHtml(bytes) {
|
|
18
|
+
const html = bytes.toString('utf8'), marker = '<a id="download-project"';
|
|
19
|
+
const start = html.indexOf(marker);
|
|
20
|
+
if (start < 0)
|
|
21
|
+
return bytes;
|
|
22
|
+
const end = html.indexOf('</a>', start + marker.length);
|
|
23
|
+
if (end < 0 || end - start > 4096 || html.indexOf(marker, end + 4) >= 0)
|
|
24
|
+
throw new Error('HTML 工程下载入口异常,请保存副本后重试');
|
|
25
|
+
return strToU8(html.slice(0, start) + html.slice(end + 4));
|
|
26
|
+
}
|
|
16
27
|
const digest = (value) => createHash('sha256').update(value).digest('hex');
|
|
17
28
|
function ordinaryFile(path) {
|
|
18
29
|
const stat = lstatSync(path);
|
|
@@ -305,7 +316,7 @@ export class PptWorkbench {
|
|
|
305
316
|
return denied;
|
|
306
317
|
try {
|
|
307
318
|
const params = new URL(request.url).searchParams, kind = params.get('kind');
|
|
308
|
-
if (!['html', 'pptx', 'json', 'bundle', 'notes', 'coaching', 'data', 'visual'].includes(String(kind)))
|
|
319
|
+
if (!['html', 'pptx', 'json', 'bundle', 'share', 'notes', 'coaching', 'data', 'visual'].includes(String(kind)))
|
|
309
320
|
return fail(400, '不支持此文件类型');
|
|
310
321
|
const { entry, manifest, files, engine } = await this.project(params.get('id'));
|
|
311
322
|
if (String(manifest.revision) !== params.get('revision'))
|
|
@@ -328,25 +339,34 @@ export class PptWorkbench {
|
|
|
328
339
|
bytes = strToU8(speakerNotes({ ...manifest, slides: manifest.slides.map((slide) => ({ ...slide, notes: engine.dataNotes(manifest, slide) })) }));
|
|
329
340
|
name = basename(entry.path, '.json') + '-speaker-notes.md';
|
|
330
341
|
}
|
|
331
|
-
else if (kind === 'bundle') {
|
|
342
|
+
else if (kind === 'bundle' || kind === 'share') {
|
|
332
343
|
const entries = {};
|
|
333
344
|
let total = 0;
|
|
334
|
-
|
|
345
|
+
const selected = kind === 'share' ? [files.html, files.pptx] : Object.values(files);
|
|
346
|
+
const add = (name, content) => { total += content.byteLength; if (total > BUNDLE_LIMIT)
|
|
347
|
+
return false; entries[name] = content; return true; };
|
|
348
|
+
for (const path of selected) {
|
|
335
349
|
if (!existsSync(path))
|
|
336
350
|
return fail(400, '成品文件不完整,请先保存一次再下载成品包');
|
|
337
|
-
const content = ordinaryFile(path);
|
|
338
|
-
|
|
339
|
-
|
|
351
|
+
const content = ordinaryFile(path), exported = kind === 'share' && path === files.html ? shareHtml(content) : content;
|
|
352
|
+
if (!add(basename(path), exported))
|
|
353
|
+
return fail(413, '成品包超过 128 MiB,请分别下载文件');
|
|
354
|
+
}
|
|
355
|
+
// An allowlist of registered sibling files; never walk project directories.
|
|
356
|
+
if (kind === 'share') {
|
|
357
|
+
const notes = speakerNotes({ ...manifest, slides: manifest.slides.map((slide) => ({ ...slide, notes: engine.dataNotes(manifest, slide) })) });
|
|
358
|
+
if (!add(basename(entry.path, '.json') + '-speaker-notes.md', strToU8(notes)))
|
|
340
359
|
return fail(413, '成品包超过 128 MiB,请分别下载文件');
|
|
341
|
-
entries[basename(path)] = content;
|
|
342
360
|
}
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
361
|
+
const details = kind === 'share'
|
|
362
|
+
? '演示文稿分享包 / Presentation share bundle\n\nPPTX: 在 PowerPoint / WPS 中打开。 / Open in PowerPoint or WPS.\nHTML: 解压后用浏览器离线放映。 / Extract and open in a browser for offline playback.\nMarkdown: 当前修订的逐页讲稿。 / Speaker notes for this revision.\n\n此包不含 JSON 工程或完整导入材料。HTML、PPTX 备注和讲稿保留已绑定的来源摘录及用户填写内容。\nThe project JSON and complete imported materials are not included. HTML, PPTX notes and speaker notes retain bound source excerpts and authored content.\n'
|
|
363
|
+
: '演示文稿工程包 / Presentation project bundle\n\nPPTX: 在 PowerPoint / WPS 中编辑。 / Edit in PowerPoint or WPS.\nHTML: 解压后用浏览器打开,支持离线放映。 / Extract and open in a browser for offline playback.\nJSON: 保留以便继续在 DSH 中编辑;其中可能包含完整导入材料。 / Keep for future DSH edits; this project may contain complete imported materials.\n';
|
|
364
|
+
if (!add('README.txt', strToU8(details + '\n修订 / Revision: ' + manifest.revision + '\n')))
|
|
365
|
+
return fail(413, '成品包超过 128 MiB,请分别下载文件');
|
|
346
366
|
// PPTX and embedded images are already compressed; store to avoid a large
|
|
347
367
|
// synchronous recompression on the host's event loop.
|
|
348
368
|
bytes = zipSync(entries, { level: 0 });
|
|
349
|
-
name = basename(entry.path, '.json') + '-delivery.zip';
|
|
369
|
+
name = basename(entry.path, '.json') + (kind === 'share' ? '-share.zip' : '-delivery.zip');
|
|
350
370
|
}
|
|
351
371
|
else {
|
|
352
372
|
const path = files[kind];
|
|
@@ -356,10 +376,11 @@ export class PptWorkbench {
|
|
|
356
376
|
request.signal.throwIfAborted();
|
|
357
377
|
if ((await this.project(entry.id)).manifest.revision !== manifest.revision)
|
|
358
378
|
return fail(409, '项目已被修改,请重新打开后下载');
|
|
359
|
-
const
|
|
379
|
+
const archive = kind === 'bundle' || kind === 'share';
|
|
380
|
+
const type = ['notes', 'coaching', 'data', 'visual'].includes(String(kind)) ? 'text/markdown; charset=utf-8' : archive ? 'application/zip' : kind === 'pptx' ? 'application/vnd.openxmlformats-officedocument.presentationml.presentation' : kind === 'html' ? 'text/html; charset=utf-8' : 'application/json; charset=utf-8';
|
|
360
381
|
return new Response(new Uint8Array(bytes), { headers: {
|
|
361
382
|
'content-type': type, 'cache-control': 'no-store', 'x-content-type-options': 'nosniff',
|
|
362
|
-
'content-disposition': `attachment; filename="presentation.${
|
|
383
|
+
'content-disposition': `attachment; filename="presentation.${archive ? 'zip' : ['notes', 'coaching', 'data', 'visual'].includes(String(kind)) ? 'md' : kind}"; filename*=UTF-8''${encodeURIComponent(name)}`,
|
|
363
384
|
} });
|
|
364
385
|
}
|
|
365
386
|
catch (error) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-ppt",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "DSH
|
|
3
|
+
"version": "0.19.1",
|
|
4
|
+
"description": "DSH 演示文稿:HTML / 可编辑 PPTX / 工程包、轻量编辑、数字溯源与现场推演,可选 AI 审阅。欢迎提交 issues 和 PR。",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"types": "lib/index.d.ts",
|