| 1 | import type { HtmlToPptxExtractionReport } from '@arcsin1/html2pptx' |
| 2 | |
| 3 | export const buildExtractionReportWarning = ( |
| 4 | pageId: string, |
| 5 | report: HtmlToPptxExtractionReport | undefined |
| 6 | ): string | undefined => { |
| 7 | if (!report) return undefined |
| 8 | const details: string[] = [] |
| 9 | if (report.textLimitReached) details.push('可编辑文本达到上限,剩余文本已保留在背景图') |
| 10 | if (report.shapeLimitReached) details.push('可编辑形状达到上限,剩余形状已保留在背景图') |
| 11 | if (report.imageLimitReached) details.push('可编辑图片达到上限,剩余图片已保留在背景图') |
| 12 | if (report.unsupportedTransformCount > 0) { |
| 13 | details.push(`${report.unsupportedTransformCount} 个复杂变换元素已保留在背景图`) |
| 14 | } |
| 15 | if (report.imageRasterFallbackCount > 0) { |
| 16 | details.push(`${report.imageRasterFallbackCount} 个图片或图表无法安全转换,已保留在背景图`) |
| 17 | } |
| 18 | return details.length > 0 ? `页面 ${pageId}:${details.join(';')}` : undefined |
| 19 | } |
| 20 |