@file-viewer/renderer-pptx 3.3.3 → 3.3.5

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/README.en.md CHANGED
@@ -11,3 +11,5 @@ import { pptxRenderer } from '@file-viewer/renderer-pptx'
11
11
  Install `@file-viewer/renderer-ppt` explicitly for legacy `.ppt`, or keep using the compatibility aggregate `@file-viewer/renderer-presentation` when both are required.
12
12
 
13
13
  Worker resolution first honors `presentation.workerUrl` or a configured shared asset base, then uses an emitted or directly served package asset, then checks the standard asset-copy manifest. Unknown locations never fall back to a guessed application-relative URL; Angular, offline, and separate static directories use the standard asset-copy command without application aliases.
14
+
15
+ An HTTP(S) PPTX module Worker on another origin loads through an owned Blob module entry. The original module URL remains the base for its relative imports and assets. The server must allow CORS, and the page's CSP must permit both `blob:` and the asset origin in `worker-src`, plus applicable `connect-src` access for fetched assets. A blocked load remains an error; it does not fall back to parsing on the main thread. Explicit classic Workers keep their original loading behavior. For cold offline use, copy the complete matching assets to the page's origin; an uncached CDN module still requires a network connection. See [module Worker loading and CSP](https://developer.mozilla.org/en-US/docs/Web/API/Worker/Worker).
package/README.md CHANGED
@@ -11,3 +11,5 @@ import { pptxRenderer } from '@file-viewer/renderer-pptx'
11
11
  Install `@file-viewer/renderer-ppt` explicitly for legacy `.ppt`, or keep using the compatibility aggregate `@file-viewer/renderer-presentation` when both are required.
12
12
 
13
13
  Worker resolution first honors `presentation.workerUrl` or a configured shared asset base, then uses an emitted or directly served package asset, then checks the standard asset-copy manifest. Unknown locations never fall back to a guessed application-relative URL; Angular, offline, and separate static directories use the standard asset-copy command without application aliases.
14
+
15
+ An HTTP(S) PPTX module Worker on another origin loads through an owned Blob module entry. The original module URL remains the base for its relative imports and assets. The server must allow CORS, and the page's CSP must permit both `blob:` and the asset origin in `worker-src`, plus applicable `connect-src` access for fetched assets. A blocked load remains an error; it does not fall back to parsing on the main thread. Explicit classic Workers keep their original loading behavior. For cold offline use, copy the complete matching assets to the page's origin; an uncached CDN module still requires a network connection. See [module Worker loading and CSP](https://developer.mozilla.org/en-US/docs/Web/API/Worker/Worker).
package/README.zh-CN.md CHANGED
@@ -11,3 +11,5 @@ import { pptxRenderer } from '@file-viewer/renderer-pptx'
11
11
  需要同时支持旧 `.ppt` 时,可显式安装 `@file-viewer/renderer-ppt`,或继续使用兼容聚合包 `@file-viewer/renderer-presentation`。
12
12
 
13
13
  Worker 选择顺序为显式 `presentation.workerUrl` 或共享资源根目录、打包器已输出或包目录内可解析的 Worker、标准复制工具的资源清单。未知路径不会回退为猜测的应用相对地址;Angular、离线或独立静态目录使用标准资产复制,无需业务 alias。
14
+
15
+ HTTP(S) 跨域 PPTX 模块 Worker 会通过本页拥有的 Blob 模块入口加载,原模块 URL 仍作为相对导入和资源地址的基准。资源服务器须允许 CORS,页面 CSP 须在 `worker-src` 同时允许 `blob:` 和资源来源,并在适用的 `connect-src` 中允许资源请求。加载被策略阻止时会保留错误,不转到主线程解析。显式 classic Worker 保留原加载方式。需要冷启动离线使用时,将匹配版本的完整资源复制到页面同源目录;未缓存的 CDN 模块仍需要网络。参见 [模块 Worker 加载与 CSP](https://developer.mozilla.org/en-US/docs/Web/API/Worker/Worker)。
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { PptxViewer, RECOMMENDED_ZIP_LIMITS, resolvePptxPackageWorkerUrl } from '@file-viewer/pptx';
2
- import { DEFAULT_RENDERER_DEFINITIONS, attachFileViewerErrorMessage, createFileViewerTranslator, createFileViewerZoomChangeEmitter, getFileViewerShadowRootForNode, getDefaultFileViewerAssetBaseUrl, normalizeFileViewerErrorMessage, registerFileViewerZoomProvider, resolveFileViewerLocale, resolveFileViewerPresentationWorkerUrl, resolveFileViewerCopiedAssetUrl, resolveFileViewerRuntimeAssetBaseUrl, waitForFileViewerNextPaint, unregisterFileViewerZoomProvider, } from '@file-viewer/core';
2
+ import { DEFAULT_RENDERER_DEFINITIONS, attachFileViewerErrorMessage, buildPrintPageStyle, createFileViewerTranslator, createFileViewerZoomChangeEmitter, getFileViewerShadowRootForNode, getDefaultFileViewerAssetBaseUrl, getElementPrintPageSize, normalizeFileViewerErrorMessage, registerFileViewerZoomProvider, resolveFileViewerLocale, resolveFileViewerPresentationWorkerUrl, resolveFileViewerCopiedAssetUrl, resolveFileViewerRuntimeAssetBaseUrl, waitForFileViewerNextPaint, unregisterFileViewerZoomProvider, } from '@file-viewer/core';
3
3
  const pptxStyle = `
4
4
  .pptx-viewer-shell{position:relative;box-sizing:border-box;min-height:100%;padding:24px 20px;background:var(--file-viewer-render-surface-background,#eef3f8);color:#1f2d3b;font-family:Aptos,'Segoe UI','PingFang SC','Microsoft YaHei',sans-serif}
5
5
  .pptx-render-surface{min-height:240px}
@@ -25,24 +25,13 @@ const pptxStyle = `
25
25
  [data-viewer-theme='dark'] .pptx-render-surface .slide,[data-viewer-theme='dark'] .pptx-render-surface [data-slide-index]{color-scheme:only light;forced-color-adjust:none}
26
26
  @media (prefers-color-scheme:dark){[data-viewer-theme='system'] .pptx-viewer-shell{background:var(--file-viewer-render-surface-background,#101820);color:#e5eef8}[data-viewer-theme='system'] .pptx-loading{border-color:rgba(148,163,184,.18);background:rgba(15,23,42,.9);color:#cbd5e1;box-shadow:0 18px 44px rgba(0,0,0,.26)}[data-viewer-theme='system'] .pptx-error{border-color:rgba(148,163,184,.18);background:#151f2b;color:#f8fafc;box-shadow:0 22px 56px rgba(0,0,0,.32)}[data-viewer-theme='system'] .pptx-error p{color:#94a3b8}[data-viewer-theme='system'] .pptx-render-surface .slide,[data-viewer-theme='system'] .pptx-render-surface [data-slide-index]{color-scheme:only light;forced-color-adjust:none}}
27
27
  `;
28
- const pptxPrintStyle = `
29
- .pptx-viewer-shell {
30
- background: #fff !important;
31
- padding: 0 !important;
32
- }
33
- .pptx-render-surface {
34
- display: block !important;
35
- overflow: visible !important;
36
- }
37
- .pptx-render-surface [data-slide-index] {
38
- break-after: page;
39
- page-break-after: always;
40
- margin: 0 auto !important;
41
- }
42
- .pptx-render-surface [data-slide-index]:last-child {
28
+ const pptxPrintStyle = `@media print {
29
+ .flyfish-pptx-export .flyfish-pptx-content .slide { margin: 0 !important; }
30
+ .flyfish-pptx-export .flyfish-pptx-content > [data-viewer-print-page-index]:last-of-type {
43
31
  break-after: auto;
44
32
  page-break-after: auto;
45
33
  }
34
+ }
46
35
  `;
47
36
  const SLIDESHOW_HOTKEY_LABEL = 'F5 / P';
48
37
  const activePptxShells = new WeakMap();
@@ -72,93 +61,23 @@ const clampZoomPercent = (value) => {
72
61
  return Math.min(300, Math.max(25, Math.round(value)));
73
62
  };
74
63
  const pptxDiagnosticMessages = {
75
- PPTX_FILE_EMPTY: {
76
- zh: '文件为空或过小,无法读取。',
77
- en: 'The file is empty or too small to read.',
78
- ja: 'ファイルが空であるか小さすぎるため、読み込めません。',
79
- de: 'Die Datei ist leer oder zu klein zum Lesen.',
80
- },
81
- PPTX_FILE_TOO_LARGE: {
82
- zh: '文件超过浏览器安全预览体积限制。',
83
- en: 'The file is larger than the browser-safe preview limit.',
84
- ja: 'ファイルがブラウザーで安全にプレビューできるサイズ上限を超えています。',
85
- de: 'Die Datei überschreitet die sichere Vorschaugröße des Browsers.',
86
- },
87
- PPTX_INVALID_ZIP: {
88
- zh: '文件不是有效的 PowerPoint OpenXML 压缩包。',
89
- en: 'The file is not a valid PowerPoint OpenXML package.',
90
- ja: '有効な PowerPoint OpenXML パッケージではありません。',
91
- de: 'Die Datei ist kein gültiges PowerPoint-OpenXML-Paket.',
92
- },
93
- PPTX_MISSING_CONTENT_TYPES: {
94
- zh: '文件缺少 [Content_Types].xml,无法识别内部结构。',
95
- en: 'The package is missing [Content_Types].xml, so its structure cannot be identified.',
96
- ja: '[Content_Types].xml がないため、内部構造を識別できません。',
97
- de: '[Content_Types].xml fehlt; die Paketstruktur kann nicht erkannt werden.',
98
- },
99
- PPTX_MISSING_PRESENTATION: {
100
- zh: '文件缺少 ppt/presentation.xml,无法读取幻灯片列表。',
101
- en: 'The package is missing ppt/presentation.xml, so the slide list cannot be read.',
102
- ja: 'ppt/presentation.xml がないため、スライド一覧を読み込めません。',
103
- de: 'ppt/presentation.xml fehlt; die Folienliste kann nicht gelesen werden.',
104
- },
105
- PPTX_NO_SLIDES: {
106
- zh: '文件中没有找到可预览的幻灯片。',
107
- en: 'No previewable slides were found in the file.',
108
- ja: 'プレビュー可能なスライドが見つかりませんでした。',
109
- de: 'Es wurden keine Folien für die Vorschau gefunden.',
110
- },
111
- PPTX_MISSING_SLIDE: {
112
- zh: '文件缺少某一页幻灯片内容。',
113
- en: 'The package is missing one of the slide parts.',
114
- ja: 'スライド部品の一部がありません。',
115
- de: 'Ein Folienbestandteil fehlt im Paket.',
116
- },
117
- PPTX_SLIDE_RENDER_FAILED: {
118
- zh: '某一页幻灯片解析失败。',
119
- en: 'One slide failed to parse.',
120
- ja: 'スライドの解析に失敗しました。',
121
- de: 'Eine Folie konnte nicht verarbeitet werden.',
122
- },
123
- PPTX_WORKER_FAILED: {
124
- zh: 'PPTX Worker 启动或运行失败。',
125
- en: 'The PPTX Worker failed to start or run.',
126
- ja: 'PPTX Worker の起動または実行に失敗しました。',
127
- de: 'Der PPTX-Worker konnte nicht gestartet oder ausgeführt werden.',
128
- },
129
- PPTX_PARSE_FAILED: {
130
- zh: 'PPTX 文件解析失败。',
131
- en: 'The PPTX file could not be parsed.',
132
- ja: 'PPTX ファイルを解析できませんでした。ファイルを再保存するか、入力元を確認してください。',
133
- de: 'Die PPTX-Datei konnte nicht verarbeitet werden.',
134
- },
64
+ "PPTX_FILE_EMPTY": "presentation.diagnostic.reason.PPTX_FILE_EMPTY",
65
+ "PPTX_FILE_TOO_LARGE": "presentation.diagnostic.reason.PPTX_FILE_TOO_LARGE",
66
+ "PPTX_INVALID_ZIP": "presentation.diagnostic.reason.PPTX_INVALID_ZIP",
67
+ "PPTX_MISSING_CONTENT_TYPES": "presentation.diagnostic.reason.PPTX_MISSING_CONTENT_TYPES",
68
+ "PPTX_MISSING_PRESENTATION": "presentation.diagnostic.reason.PPTX_MISSING_PRESENTATION",
69
+ "PPTX_NO_SLIDES": "presentation.diagnostic.reason.PPTX_NO_SLIDES",
70
+ "PPTX_MISSING_SLIDE": "presentation.diagnostic.reason.PPTX_MISSING_SLIDE",
71
+ "PPTX_SLIDE_RENDER_FAILED": "presentation.diagnostic.reason.PPTX_SLIDE_RENDER_FAILED",
72
+ "PPTX_WORKER_FAILED": "presentation.diagnostic.reason.PPTX_WORKER_FAILED",
73
+ "PPTX_PARSE_FAILED": "presentation.diagnostic.reason.PPTX_PARSE_FAILED"
135
74
  };
136
75
  const pptxDiagnosticFallbackHints = {
137
- PPTX_INVALID_ZIP: {
138
- zh: '请确认接口返回的是原始 .pptx 二进制文件,而不是登录页、HTML/JSON 错误响应或被截断的内容。',
139
- en: 'Confirm that the response is the original .pptx binary, not a login page, HTML/JSON error response, or truncated download.',
140
- ja: 'レスポンスがログインページや HTML/JSON エラー、途中で切れたデータではなく、元の .pptx バイナリであることを確認してください。',
141
- de: 'Prüfen Sie, ob die Antwort die ursprüngliche .pptx-Datei und keine Anmeldeseite, HTML/JSON-Fehlerantwort oder unvollständige Datei enthält.',
142
- },
143
- PPTX_WORKER_FAILED: {
144
- zh: '请检查 presentation.workerUrl、Worker 文件路径、MIME 类型、CSP 和跨域策略。',
145
- en: 'Check presentation.workerUrl, the Worker file path, MIME type, CSP, and cross-origin policy.',
146
- ja: 'presentation.workerUrl、Worker のパス、MIME type、CSP、cross-origin policy を確認してください。',
147
- de: 'Prüfen Sie presentation.workerUrl, den Worker-Pfad, den MIME-Typ, CSP und die Cross-Origin-Richtlinie.',
148
- },
149
- PPTX_NO_SLIDES: {
150
- zh: '请重新保存演示文稿,或检查包内是否存在 ppt/slides/slide*.xml。',
151
- en: 'Re-save the presentation, or check whether ppt/slides/slide*.xml exists inside the package.',
152
- ja: 'プレゼンテーションを再保存するか、パッケージに ppt/slides/slide*.xml があるか確認してください。',
153
- de: 'Speichern Sie die Präsentation erneut oder prüfen Sie, ob ppt/slides/slide*.xml im Paket vorhanden ist.',
154
- },
155
- };
156
- const localizePptxDiagnosticCopy = (copy, locale) => {
157
- if (!copy) {
158
- return '';
159
- }
160
- return locale === 'zh-CN' ? copy.zh : locale === 'ja-JP' ? copy.ja : locale === 'de-DE' ? copy.de : copy.en;
76
+ "PPTX_INVALID_ZIP": "presentation.diagnostic.hint.PPTX_INVALID_ZIP",
77
+ "PPTX_WORKER_FAILED": "presentation.diagnostic.hint.PPTX_WORKER_FAILED",
78
+ "PPTX_NO_SLIDES": "presentation.diagnostic.hint.PPTX_NO_SLIDES"
161
79
  };
80
+ const localizePptxDiagnosticCopy = (key, input) => key ? createFileViewerTranslator(input)(key) : '';
162
81
  const sanitizePptxDiagnosticText = (value) => {
163
82
  if (typeof value !== 'string') {
164
83
  return '';
@@ -223,29 +142,28 @@ const classifyPptxErrorString = (message) => {
223
142
  }
224
143
  return null;
225
144
  };
226
- const formatPptxDiagnosticError = (error, fallback, context) => {
227
- const locale = resolveFileViewerLocale(context === null || context === void 0 ? void 0 : context.options);
145
+ const formatPptxDiagnosticError = (error, fallback, context, i18n = (context === null || context === void 0 ? void 0 : context.i18n) || (context === null || context === void 0 ? void 0 : context.options)) => {
146
+ const t = createFileViewerTranslator(i18n);
147
+ const locale = resolveFileViewerLocale(i18n);
228
148
  const code = String(error.code || 'PPTX_PARSE_FAILED');
229
- const localizedReason = localizePptxDiagnosticCopy(pptxDiagnosticMessages[code], locale);
149
+ const localizedReason = localizePptxDiagnosticCopy(pptxDiagnosticMessages[code], i18n);
230
150
  const rawReason = sanitizePptxDiagnosticText(error.message);
231
- const reason = (locale === 'zh-CN'
232
- ? rawReason || localizedReason
233
- : localizedReason || rawReason) || fallback;
151
+ const reason = localizedReason || rawReason || fallback;
234
152
  const detail = sanitizePptxDiagnosticText(error.detail);
235
- const hint = localizePptxDiagnosticCopy(pptxDiagnosticFallbackHints[code], locale) ||
153
+ const hint = localizePptxDiagnosticCopy(pptxDiagnosticFallbackHints[code], i18n) ||
236
154
  sanitizePptxDiagnosticText(error.hint);
237
155
  const stage = sanitizePptxDiagnosticText(error.stage);
238
- const usesWesternPunctuation = locale === 'en-US' || locale === 'de-DE';
156
+ const usesWesternPunctuation = !locale.startsWith('zh') && locale !== 'ja-JP';
239
157
  const separator = usesWesternPunctuation ? ': ' : ':';
240
158
  const parts = [`${fallback}${separator}${reason}`];
241
159
  if (stage) {
242
- parts.push(locale === 'zh-CN' ? `阶段:${stage}` : locale === 'ja-JP' ? `段階:${stage}` : locale === 'de-DE' ? `Phase: ${stage}` : `Stage: ${stage}`);
160
+ parts.push(t('presentation.diagnostic.stage', { value: stage }));
243
161
  }
244
162
  if (detail && detail !== reason) {
245
- parts.push(locale === 'zh-CN' ? `详情:${detail}` : locale === 'ja-JP' ? `詳細:${detail}` : locale === 'de-DE' ? `Details: ${detail}` : `Detail: ${detail}`);
163
+ parts.push(t('presentation.diagnostic.detail', { value: detail }));
246
164
  }
247
165
  if (hint) {
248
- parts.push(locale === 'zh-CN' ? `建议:${hint}` : locale === 'ja-JP' ? `対処:${hint}` : locale === 'de-DE' ? `Hinweis: ${hint}` : `Hint: ${hint}`);
166
+ parts.push(t('presentation.diagnostic.hint', { value: hint }));
249
167
  }
250
168
  return parts.join(usesWesternPunctuation ? '; ' : ';');
251
169
  };
@@ -254,7 +172,7 @@ const formatErrorMessage = (error, fallback, context) => {
254
172
  return formatPptxDiagnosticError(error, fallback, context);
255
173
  }
256
174
  if (error instanceof Error || typeof error === 'string') {
257
- const normalized = normalizeFileViewerErrorMessage(error, context === null || context === void 0 ? void 0 : context.options);
175
+ const normalized = normalizeFileViewerErrorMessage(error, (context === null || context === void 0 ? void 0 : context.i18n) || (context === null || context === void 0 ? void 0 : context.options));
258
176
  const classified = classifyPptxErrorString(normalized);
259
177
  if (classified) {
260
178
  return formatPptxDiagnosticError(classified, fallback, context);
@@ -288,10 +206,20 @@ const collectPptxPrintMaskPages = (surface) => {
288
206
  const buildExportAdapter = (surface, targetWindow, getViewer) => ({
289
207
  print: true,
290
208
  exportHtml: true,
291
- includeDocumentStyles: true,
209
+ includeDocumentStyles: false,
292
210
  beforeSnapshot: () => waitForFileViewerNextPaint(targetWindow || undefined),
293
211
  getPrintMaskPages: () => collectPptxPrintMaskPages(surface),
294
- printStyle: pptxPrintStyle,
212
+ printStyle: () => {
213
+ var _a;
214
+ const slide = surface.querySelector('.flyfish-pptx-content .slide');
215
+ const size = ((_a = getViewer()) === null || _a === void 0 ? void 0 : _a.slideDimensions) || (slide && getElementPrintPageSize(slide));
216
+ return (size === null || size === void 0 ? void 0 : size.width) && size.height
217
+ ? buildPrintPageStyle({
218
+ ...size,
219
+ selector: '.flyfish-pptx-export [data-viewer-print-page-index]',
220
+ }) + pptxPrintStyle
221
+ : pptxPrintStyle;
222
+ },
295
223
  toHtml: async () => {
296
224
  var _a;
297
225
  const clone = await ((_a = getViewer()) === null || _a === void 0 ? void 0 : _a.cloneForExport()) || surface.cloneNode(true);
@@ -303,13 +231,14 @@ const buildExportAdapter = (surface, targetWindow, getViewer) => ({
303
231
  });
304
232
  export default async function renderPptx(buffer, target, _type, context) {
305
233
  var _a;
306
- const t = createFileViewerTranslator(context === null || context === void 0 ? void 0 : context.options);
234
+ const t = createFileViewerTranslator((context === null || context === void 0 ? void 0 : context.i18n) || (context === null || context === void 0 ? void 0 : context.options));
307
235
  const documentRef = target.ownerDocument || document;
308
236
  const targetWindow = documentRef.defaultView || (typeof window !== 'undefined' ? window : null);
309
237
  const zoomEmitter = createFileViewerZoomChangeEmitter();
310
238
  let viewer = null;
311
239
  let state = 'loading';
312
240
  let errorMessage = '';
241
+ let errorCopy;
313
242
  let zoomPercent = 100;
314
243
  let progressiveReady = false;
315
244
  let disposed = false;
@@ -318,16 +247,16 @@ export default async function renderPptx(buffer, target, _type, context) {
318
247
  shell.dataset.viewerZoomProvider = 'pptx';
319
248
  const loading = createElement(documentRef, 'div', 'pptx-loading');
320
249
  loading.setAttribute('aria-live', 'polite');
321
- loading.append(createElement(documentRef, 'span', 'pptx-loading-dot'), createElement(documentRef, 'span', undefined, t('presentation.state.loading')));
250
+ loading.append(createElement(documentRef, 'span', 'pptx-loading-dot'), t.text(createElement(documentRef, 'span', undefined), 'presentation.state.loading'));
322
251
  const error = createElement(documentRef, 'div', 'pptx-error');
323
- const errorTitle = createElement(documentRef, 'strong', undefined, t('presentation.error.title'));
252
+ const errorTitle = t.text(createElement(documentRef, 'strong', undefined), 'presentation.error.title');
324
253
  const errorText = createElement(documentRef, 'p');
325
254
  error.append(errorTitle, errorText);
326
255
  const slideshowButton = createElement(documentRef, 'button', 'pptx-slideshow-button');
327
256
  slideshowButton.type = 'button';
328
257
  slideshowButton.hidden = true;
329
258
  const slideshowGlyph = createElement(documentRef, 'span', 'pptx-slideshow-button-glyph', '▶');
330
- const slideshowText = createElement(documentRef, 'span', undefined, t('presentation.slideshow.start'));
259
+ const slideshowText = t.text(createElement(documentRef, 'span', undefined), 'presentation.slideshow.start');
331
260
  const slideshowKey = createElement(documentRef, 'span', 'pptx-slideshow-button-key', SLIDESHOW_HOTKEY_LABEL);
332
261
  slideshowButton.append(slideshowGlyph, slideshowText, slideshowKey);
333
262
  slideshowButton.addEventListener('click', () => {
@@ -447,13 +376,15 @@ export default async function renderPptx(buffer, target, _type, context) {
447
376
  var _a;
448
377
  loading.hidden = !(state === 'loading' && !errorMessage);
449
378
  error.hidden = state !== 'error';
450
- errorText.textContent = errorMessage;
379
+ t.bind(errorText, node => { node.textContent = (errorCopy === null || errorCopy === void 0 ? void 0 : errorCopy(context === null || context === void 0 ? void 0 : context.options)) || errorMessage; });
451
380
  surface.classList.toggle('is-loading', state === 'loading');
452
381
  const presenting = Boolean(viewer === null || viewer === void 0 ? void 0 : viewer.presenting);
453
382
  slideshowButton.hidden = state !== 'ready' || ((_a = viewer === null || viewer === void 0 ? void 0 : viewer.slideCount) !== null && _a !== void 0 ? _a : 0) === 0;
454
- slideshowText.textContent = presenting
455
- ? t('presentation.slideshow.exit')
456
- : t('presentation.slideshow.start');
383
+ t.bind(slideshowText, localizedNode => {
384
+ localizedNode.textContent = presenting
385
+ ? t('presentation.slideshow.exit')
386
+ : t('presentation.slideshow.start');
387
+ }, 'textContent');
457
388
  slideshowButton.setAttribute('aria-pressed', presenting ? 'true' : 'false');
458
389
  };
459
390
  const registerExportAdapter = () => {
@@ -463,10 +394,14 @@ export default async function renderPptx(buffer, target, _type, context) {
463
394
  const reportPptxFailure = (failure) => {
464
395
  var _a;
465
396
  state = 'error';
397
+ const retainedDiagnostic = isPptxDiagnosticErrorLike(failure)
398
+ ? { ...failure }
399
+ : classifyPptxErrorString(normalizeFileViewerErrorMessage(failure, (context === null || context === void 0 ? void 0 : context.i18n) || (context === null || context === void 0 ? void 0 : context.options)));
400
+ errorCopy = retainedDiagnostic ? i18n => formatPptxDiagnosticError(retainedDiagnostic, createFileViewerTranslator(i18n)('presentation.error.parseFailed'), context, i18n) : undefined;
466
401
  errorMessage = formatErrorMessage(failure, t('presentation.error.parseFailed'), context);
467
402
  (_a = context === null || context === void 0 ? void 0 : context.registerExportAdapter) === null || _a === void 0 ? void 0 : _a.call(context, null);
468
403
  syncUi();
469
- return attachFileViewerErrorMessage(failure, errorMessage);
404
+ return attachFileViewerErrorMessage(failure, errorCopy || errorMessage);
470
405
  };
471
406
  registerFileViewerZoomProvider(shell, {
472
407
  zoomIn: () => setZoom(getCurrentZoomPercent() + 15),
@@ -480,6 +415,7 @@ export default async function renderPptx(buffer, target, _type, context) {
480
415
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
481
416
  state = 'loading';
482
417
  errorMessage = '';
418
+ errorCopy = undefined;
483
419
  progressiveReady = false;
484
420
  syncUi();
485
421
  const presentationOptions = (_a = context === null || context === void 0 ? void 0 : context.options) === null || _a === void 0 ? void 0 : _a.presentation;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@file-viewer/renderer-pptx",
3
- "version": "3.3.3",
3
+ "version": "3.3.5",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Standalone OpenXML PowerPoint renderer for PPTX, PPTM, POTX, POTM, PPSX, and PPSM files.",
@@ -54,8 +54,8 @@
54
54
  "README.zh-CN.md"
55
55
  ],
56
56
  "dependencies": {
57
- "@file-viewer/core": "3.3.3",
58
- "@file-viewer/pptx": "3.3.3"
57
+ "@file-viewer/core": "3.3.5",
58
+ "@file-viewer/pptx": "3.3.5"
59
59
  },
60
60
  "fileViewer": {
61
61
  "capabilityManifest": "./file-viewer.capability.json",