jvs-ppt-ui 0.0.35 → 0.0.37
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/dist/lib/jvs-ppt-ui/iconfont/iconfont.css +7 -3
- package/dist/lib/jvs-ppt-ui/iconfont/iconfont.js +1 -1
- package/dist/lib/jvs-ppt-ui/iconfont/iconfont.json +7 -0
- package/dist/lib/jvs-ppt-ui/iconfont/iconfont.ttf +0 -0
- package/dist/lib/jvs-ppt-ui/iconfont/iconfont.woff +0 -0
- package/dist/lib/jvs-ppt-ui/iconfont/iconfont.woff2 +0 -0
- package/dist/lib/jvs-ppt-ui/layout-library/layout-image/img_01de32e3d01df54a.svg +9 -0
- package/dist/lib/jvs-ppt-ui/layout-library/layout-image/img_12935f21f0b1ae78.png +0 -0
- package/dist/lib/jvs-ppt-ui/layout-library/layout-image/img_201146e666f28fff.png +0 -0
- package/dist/lib/jvs-ppt-ui/layout-library/layout-image/img_32ef4f2c1d76ea32.svg +15 -0
- package/dist/lib/jvs-ppt-ui/layout-library/layout-image/img_571054b13f220252.svg +10 -0
- package/dist/lib/jvs-ppt-ui/layout-library/layout-image/img_5b14f99769a8894c.svg +10 -0
- package/dist/lib/jvs-ppt-ui/layout-library/layout-image/img_62fc021bdae89b21.png +0 -0
- package/dist/lib/jvs-ppt-ui/layout-library/layout-image/img_649d2b36f7fc251e.png +0 -0
- package/dist/lib/jvs-ppt-ui/layout-library/layout-image/img_7e57de8ea8d46aba.png +0 -0
- package/dist/lib/jvs-ppt-ui/layout-library/layout-image/img_9ad1284e63535689.svg +15 -0
- package/dist/lib/jvs-ppt-ui/layout-library/layout-image/img_9ff268d3709d6454.png +0 -0
- package/dist/lib/jvs-ppt-ui/layout-library/layout-image/img_b8f80ac591d69945.png +0 -0
- package/dist/lib/jvs-ppt-ui/layout-library/layout-image/img_dce239981c2cd1aa.svg +15 -0
- package/dist/lib/jvs-ppt-ui/layout-library/layout-image/img_e2ea31ca7735e5c0.png +0 -0
- package/dist/lib/jvs-ppt-ui/layout-library/layout-image/img_e585ddb9ec5c408e.png +0 -0
- package/dist/lib/jvs-ppt-ui/layout-library/layout-image/img_f3335fad3673d648.svg +10 -0
- package/dist/lib/jvs-ppt-ui/layout-library/layout-image/img_fb925327432cc7e7.svg +15 -0
- package/dist/lib/jvs-ppt-ui/layout-library/layout-library.json +1 -0
- package/dist/lib/jvs-ppt-ui.es.js +81545 -23219
- package/dist/lib/jvs-ppt-ui.umd.js +113 -112
- package/dist/lib/style.css +1 -1
- package/package.json +1 -1
- package/scripts/patch-pptxtojson.cjs +33 -0
- package/src/assets/chart/baseArea.png +0 -0
- package/src/assets/chart/baseBar.png +0 -0
- package/src/assets/chart/baseHistogram.png +0 -0
- package/src/assets/chart/basePie.png +0 -0
- package/src/assets/chart/bubbleChart.png +0 -0
- package/src/assets/chart/circyChart.png +0 -0
- package/src/assets/chart/compPolyline.png +0 -0
- package/src/assets/chart/lineChart.png +0 -0
- package/src/assets/chart/otherLine.png +0 -0
- package/src/assets/chart/otherLineChart.png +0 -0
- package/src/assets/chart/perHistogram.png +0 -0
- package/src/assets/chart/radarChart.png +0 -0
- package/src/assets/chart/roseChart.png +0 -0
- package/src/assets/chart/roseCircyChart.png +0 -0
- package/src/assets/chart/stackArea.png +0 -0
- package/src/assets/chart/stackBar.png +0 -0
- package/src/assets/chart/stackHistogram.png +0 -0
- package/src/assets/iconfont/iconfont.js +1 -1
- package/src/components/CanvasArea.vue +26 -13
- package/src/components/ChartTypeSelector.vue +15 -67
- package/src/components/Header.vue +10 -7
- package/src/components/SidebarLeft.vue +382 -30
- package/src/components/SidebarRight.vue +39 -1
- package/src/components/sidebar/panels/LayoutThumbSvg.vue +82 -14
- package/src/components/sidebar/panels/SidebarChartFormatPanel.vue +676 -3
- package/src/composables/sidebar/useSidebarChart.ts +88 -39
- package/src/composables/useSlides.ts +245 -25
- package/src/configs/layoutLibrary.ts +113 -0
- package/src/style.css +107 -17
- package/src/utils/pptxAnimationInjector.ts +36 -4
- package/src/assets/chart/baseMap.png +0 -0
- package/src/assets/chart/boxplot.png +0 -0
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { parseTemplateJsonToDeck, type SlideTemplateItem } from './slideTemplates'
|
|
2
|
+
|
|
3
|
+
export const DEFAULT_LAYOUT_LIBRARY_CATEGORIES = [
|
|
4
|
+
'基础版式',
|
|
5
|
+
'网格布局',
|
|
6
|
+
'图表与数据',
|
|
7
|
+
'时间轴与计划',
|
|
8
|
+
'价格方案',
|
|
9
|
+
'目录与议程',
|
|
10
|
+
'人物与团队',
|
|
11
|
+
'金句与证言',
|
|
12
|
+
'设备样机'
|
|
13
|
+
]
|
|
14
|
+
|
|
15
|
+
// 将 public/jvs-ppt-ui/layout-library/layout-image 下的 17 个轻量资源通过 Vite 内联映射,
|
|
16
|
+
// 确保作为 NPM 插件在任何宿主项目中使用时无需额外部署静态目录即可 100% 开箱即用
|
|
17
|
+
const inlineImageModules = import.meta.glob<string>(
|
|
18
|
+
'../../public/jvs-ppt-ui/layout-library/layout-image/*',
|
|
19
|
+
{ eager: true, query: '?inline', import: 'default' }
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
const layoutImageMap: Record<string, string> = {}
|
|
23
|
+
for (const [modPath, dataUrl] of Object.entries(inlineImageModules)) {
|
|
24
|
+
const fileName = modPath.split('/').pop()
|
|
25
|
+
if (fileName && typeof dataUrl === 'string') {
|
|
26
|
+
layoutImageMap[fileName] = dataUrl
|
|
27
|
+
layoutImageMap[`/jvs-ppt-ui/layout-library/layout-image/${fileName}`] = dataUrl
|
|
28
|
+
layoutImageMap[`/templates/layout-image/${fileName}`] = dataUrl
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function resolveLayoutSlideAssets(slide: any): any {
|
|
33
|
+
if (!slide || typeof slide !== 'object') return slide
|
|
34
|
+
const walkElements = (elements: any[]) => {
|
|
35
|
+
for (const el of elements) {
|
|
36
|
+
if (!el || typeof el !== 'object') continue
|
|
37
|
+
for (const key of ['content', 'src'] as const) {
|
|
38
|
+
const val = el[key]
|
|
39
|
+
if (typeof val === 'string') {
|
|
40
|
+
if (layoutImageMap[val]) {
|
|
41
|
+
el[key] = layoutImageMap[val]
|
|
42
|
+
} else {
|
|
43
|
+
const fileName = val.split('/').pop() || ''
|
|
44
|
+
if (fileName && layoutImageMap[fileName] && (val.includes('/layout-image/') || val.startsWith('layout-image/'))) {
|
|
45
|
+
el[key] = layoutImageMap[fileName]
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
if (Array.isArray(el.elements)) {
|
|
51
|
+
walkElements(el.elements)
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
if (Array.isArray(slide.elements)) {
|
|
56
|
+
walkElements(slide.elements)
|
|
57
|
+
}
|
|
58
|
+
return slide
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
let cachedResult: {
|
|
62
|
+
deck: SlideTemplateItem
|
|
63
|
+
slides: any[]
|
|
64
|
+
categories: string[]
|
|
65
|
+
} | null = null
|
|
66
|
+
|
|
67
|
+
export async function loadBuiltinLayoutLibrary(): Promise<{
|
|
68
|
+
deck: SlideTemplateItem
|
|
69
|
+
slides: any[]
|
|
70
|
+
categories: string[]
|
|
71
|
+
}> {
|
|
72
|
+
if (cachedResult) return cachedResult
|
|
73
|
+
|
|
74
|
+
const mod = await import('../../public/jvs-ppt-ui/layout-library/layout-library.json')
|
|
75
|
+
const rawJson: any = mod.default || mod
|
|
76
|
+
|
|
77
|
+
const parsed = parseTemplateJsonToDeck(rawJson, 'Pitch 官方版式库')
|
|
78
|
+
const normalizedSlides = (parsed.slides || []).map((s: any, idx: number) => {
|
|
79
|
+
const rawTitle = (s.title || `版式 ${idx + 1}`).trim()
|
|
80
|
+
const m = rawTitle.match(/^\[([^\]]+)\]\s*(.*)$/)
|
|
81
|
+
const category = s.category || (m ? m[1].trim() : '基础版式')
|
|
82
|
+
const cleanName = s.name || (m ? m[2].trim() : rawTitle) || rawTitle
|
|
83
|
+
const slideCopy = {
|
|
84
|
+
...s,
|
|
85
|
+
category,
|
|
86
|
+
name: cleanName
|
|
87
|
+
}
|
|
88
|
+
return resolveLayoutSlideAssets(slideCopy)
|
|
89
|
+
})
|
|
90
|
+
|
|
91
|
+
let categories = [...DEFAULT_LAYOUT_LIBRARY_CATEGORIES]
|
|
92
|
+
if (Array.isArray(rawJson?.categories) && rawJson.categories.length > 0) {
|
|
93
|
+
const catNames = rawJson.categories
|
|
94
|
+
.map((c: any) => (typeof c === 'string' ? c : c?.name))
|
|
95
|
+
.filter(Boolean)
|
|
96
|
+
if (catNames.length > 0) {
|
|
97
|
+
categories = catNames
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
const deck: SlideTemplateItem = {
|
|
102
|
+
...parsed,
|
|
103
|
+
name: 'Pitch 官方版式库',
|
|
104
|
+
slides: normalizedSlides
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
cachedResult = {
|
|
108
|
+
deck,
|
|
109
|
+
slides: normalizedSlides,
|
|
110
|
+
categories
|
|
111
|
+
}
|
|
112
|
+
return cachedResult
|
|
113
|
+
}
|
package/src/style.css
CHANGED
|
@@ -3974,7 +3974,7 @@ td.selected-cell.focused-cell,
|
|
|
3974
3974
|
}
|
|
3975
3975
|
|
|
3976
3976
|
.preset-layout-tab.is-active {
|
|
3977
|
-
color: #
|
|
3977
|
+
color: #1677ff !important;
|
|
3978
3978
|
font-weight: 600;
|
|
3979
3979
|
}
|
|
3980
3980
|
|
|
@@ -3985,10 +3985,100 @@ td.selected-cell.focused-cell,
|
|
|
3985
3985
|
right: 0;
|
|
3986
3986
|
bottom: 0;
|
|
3987
3987
|
height: 2px;
|
|
3988
|
-
background: #
|
|
3988
|
+
background: #1677ff !important;
|
|
3989
3989
|
border-radius: 1px;
|
|
3990
3990
|
}
|
|
3991
3991
|
|
|
3992
|
+
.preset-layout-category-bar-wrap {
|
|
3993
|
+
position: relative;
|
|
3994
|
+
display: flex;
|
|
3995
|
+
align-items: center;
|
|
3996
|
+
height: 40px;
|
|
3997
|
+
border-bottom: 1px solid #f1f5f9;
|
|
3998
|
+
background: #ffffff;
|
|
3999
|
+
overflow: hidden;
|
|
4000
|
+
flex-shrink: 0;
|
|
4001
|
+
}
|
|
4002
|
+
|
|
4003
|
+
.preset-layout-category-bar {
|
|
4004
|
+
display: flex;
|
|
4005
|
+
align-items: center;
|
|
4006
|
+
gap: 18px;
|
|
4007
|
+
padding: 0 20px;
|
|
4008
|
+
width: 100%;
|
|
4009
|
+
height: 100%;
|
|
4010
|
+
overflow-x: auto;
|
|
4011
|
+
overflow-y: hidden;
|
|
4012
|
+
scrollbar-width: none;
|
|
4013
|
+
-ms-overflow-style: none;
|
|
4014
|
+
scroll-behavior: smooth;
|
|
4015
|
+
}
|
|
4016
|
+
|
|
4017
|
+
.preset-layout-category-bar::-webkit-scrollbar {
|
|
4018
|
+
display: none;
|
|
4019
|
+
}
|
|
4020
|
+
|
|
4021
|
+
.preset-layout-category-item {
|
|
4022
|
+
position: relative;
|
|
4023
|
+
display: inline-flex;
|
|
4024
|
+
align-items: center;
|
|
4025
|
+
height: 100%;
|
|
4026
|
+
padding: 0;
|
|
4027
|
+
border: none;
|
|
4028
|
+
background: transparent;
|
|
4029
|
+
font-size: 13px;
|
|
4030
|
+
font-weight: 400;
|
|
4031
|
+
color: #64748b;
|
|
4032
|
+
white-space: nowrap;
|
|
4033
|
+
cursor: pointer;
|
|
4034
|
+
flex-shrink: 0;
|
|
4035
|
+
transition: color 0.15s ease;
|
|
4036
|
+
}
|
|
4037
|
+
|
|
4038
|
+
.preset-layout-category-item:hover {
|
|
4039
|
+
color: #1e293b;
|
|
4040
|
+
}
|
|
4041
|
+
|
|
4042
|
+
.preset-layout-category-item.is-active {
|
|
4043
|
+
color: #0f172a;
|
|
4044
|
+
font-weight: 600;
|
|
4045
|
+
}
|
|
4046
|
+
|
|
4047
|
+
.preset-cat-scroll-btn {
|
|
4048
|
+
position: absolute;
|
|
4049
|
+
top: 0;
|
|
4050
|
+
bottom: 0;
|
|
4051
|
+
z-index: 3;
|
|
4052
|
+
display: inline-flex;
|
|
4053
|
+
align-items: center;
|
|
4054
|
+
justify-content: center;
|
|
4055
|
+
width: 32px;
|
|
4056
|
+
border: none;
|
|
4057
|
+
color: #475569;
|
|
4058
|
+
cursor: pointer;
|
|
4059
|
+
transition: color 0.15s ease;
|
|
4060
|
+
}
|
|
4061
|
+
|
|
4062
|
+
.preset-cat-scroll-btn:hover {
|
|
4063
|
+
color: #0f172a;
|
|
4064
|
+
}
|
|
4065
|
+
|
|
4066
|
+
.preset-cat-scroll-btn.is-left {
|
|
4067
|
+
left: 0;
|
|
4068
|
+
padding-right: 6px;
|
|
4069
|
+
background: linear-gradient(90deg, #ffffff 65%, rgba(255, 255, 255, 0));
|
|
4070
|
+
}
|
|
4071
|
+
|
|
4072
|
+
.preset-cat-scroll-btn.is-right {
|
|
4073
|
+
right: 0;
|
|
4074
|
+
padding-left: 6px;
|
|
4075
|
+
background: linear-gradient(270deg, #ffffff 65%, rgba(255, 255, 255, 0));
|
|
4076
|
+
}
|
|
4077
|
+
|
|
4078
|
+
.preset-layout-library-body {
|
|
4079
|
+
max-height: min(600px, calc(100vh - 180px));
|
|
4080
|
+
}
|
|
4081
|
+
|
|
3992
4082
|
.preset-template-upload-btn {
|
|
3993
4083
|
display: inline-flex;
|
|
3994
4084
|
align-items: center;
|
|
@@ -4005,9 +4095,9 @@ td.selected-cell.focused-cell,
|
|
|
4005
4095
|
}
|
|
4006
4096
|
|
|
4007
4097
|
.preset-template-upload-btn:hover {
|
|
4008
|
-
background: #
|
|
4009
|
-
border-color: #
|
|
4010
|
-
color: #
|
|
4098
|
+
background: #e6f4ff;
|
|
4099
|
+
border-color: #91caff;
|
|
4100
|
+
color: #1677ff !important;
|
|
4011
4101
|
}
|
|
4012
4102
|
|
|
4013
4103
|
.preset-template-search-box {
|
|
@@ -4026,8 +4116,8 @@ td.selected-cell.focused-cell,
|
|
|
4026
4116
|
}
|
|
4027
4117
|
|
|
4028
4118
|
.preset-template-search-box:focus-within {
|
|
4029
|
-
border-color: #
|
|
4030
|
-
box-shadow: 0 0 0 2px rgba(
|
|
4119
|
+
border-color: #1677ff;
|
|
4120
|
+
box-shadow: 0 0 0 2px rgba(22, 119, 255, 0.12);
|
|
4031
4121
|
}
|
|
4032
4122
|
|
|
4033
4123
|
.preset-template-search-icon {
|
|
@@ -4087,8 +4177,8 @@ td.selected-cell.focused-cell,
|
|
|
4087
4177
|
|
|
4088
4178
|
.preset-template-card:hover .preset-template-thumb,
|
|
4089
4179
|
.preset-template-slide-item:hover .preset-template-slide-thumb {
|
|
4090
|
-
border-color: #
|
|
4091
|
-
box-shadow: 0 0 0 1px #
|
|
4180
|
+
border-color: #1677ff !important;
|
|
4181
|
+
box-shadow: 0 0 0 1px #1677ff, 0 6px 14px rgba(22, 119, 255, 0.12);
|
|
4092
4182
|
}
|
|
4093
4183
|
|
|
4094
4184
|
.preset-template-name {
|
|
@@ -4123,7 +4213,7 @@ td.selected-cell.focused-cell,
|
|
|
4123
4213
|
align-items: center;
|
|
4124
4214
|
justify-content: center;
|
|
4125
4215
|
background: rgba(255, 255, 255, 0.82);
|
|
4126
|
-
color: #
|
|
4216
|
+
color: #1677ff !important;
|
|
4127
4217
|
font-size: 12px;
|
|
4128
4218
|
font-weight: 600;
|
|
4129
4219
|
}
|
|
@@ -4191,8 +4281,8 @@ td.selected-cell.focused-cell,
|
|
|
4191
4281
|
.preset-template-detail-title .detail-count-badge {
|
|
4192
4282
|
font-size: 11px;
|
|
4193
4283
|
font-weight: 500;
|
|
4194
|
-
color: #
|
|
4195
|
-
background: #
|
|
4284
|
+
color: #1677ff !important;
|
|
4285
|
+
background: #e6f4ff !important;
|
|
4196
4286
|
padding: 1px 7px;
|
|
4197
4287
|
border-radius: 10px;
|
|
4198
4288
|
flex-shrink: 0;
|
|
@@ -4202,8 +4292,8 @@ td.selected-cell.focused-cell,
|
|
|
4202
4292
|
padding: 5px 11px;
|
|
4203
4293
|
border-radius: 6px;
|
|
4204
4294
|
border: none;
|
|
4205
|
-
background: #
|
|
4206
|
-
color: #ffffff;
|
|
4295
|
+
background: #1677ff !important;
|
|
4296
|
+
color: #ffffff !important;
|
|
4207
4297
|
font-size: 12px;
|
|
4208
4298
|
font-weight: 500;
|
|
4209
4299
|
cursor: pointer;
|
|
@@ -4212,7 +4302,7 @@ td.selected-cell.focused-cell,
|
|
|
4212
4302
|
}
|
|
4213
4303
|
|
|
4214
4304
|
.preset-template-insert-all-btn:hover {
|
|
4215
|
-
background: #
|
|
4305
|
+
background: #4096ff !important;
|
|
4216
4306
|
}
|
|
4217
4307
|
|
|
4218
4308
|
.preset-template-slide-index {
|
|
@@ -4237,8 +4327,8 @@ td.selected-cell.focused-cell,
|
|
|
4237
4327
|
z-index: 2;
|
|
4238
4328
|
padding: 2px 8px;
|
|
4239
4329
|
border-radius: 6px;
|
|
4240
|
-
background: #
|
|
4241
|
-
color: #ffffff;
|
|
4330
|
+
background: #1677ff !important;
|
|
4331
|
+
color: #ffffff !important;
|
|
4242
4332
|
font-size: 10.5px;
|
|
4243
4333
|
font-weight: 500;
|
|
4244
4334
|
opacity: 0;
|
|
@@ -501,10 +501,27 @@ async function injectMasterAndLayouts(loadedZip: JSZip, zipMeta: any, slides: Sl
|
|
|
501
501
|
return false
|
|
502
502
|
}
|
|
503
503
|
|
|
504
|
-
// 1. 覆盖写入所有 slideMasters 及其 _rels
|
|
504
|
+
// 1. 覆盖写入所有 slideMasters 及其 _rels
|
|
505
|
+
const injectedMasterXmlFiles = Object.keys(zipMeta.masterFilesMap).filter(k => k.endsWith('.xml') && !k.includes('_rels'))
|
|
506
|
+
if (injectedMasterXmlFiles.length > 0 && !zipMeta.masterFilesMap['ppt/slideMasters/slideMaster1.xml']) {
|
|
507
|
+
loadedZip.remove('ppt/slideMasters/slideMaster1.xml')
|
|
508
|
+
loadedZip.remove('ppt/slideMasters/_rels/slideMaster1.xml.rels')
|
|
509
|
+
const primaryMasterRelTarget = injectedMasterXmlFiles[0].replace(/^ppt\//, '')
|
|
510
|
+
const presRelsPath = 'ppt/_rels/presentation.xml.rels'
|
|
511
|
+
const presRelsXml = await loadedZip.file(presRelsPath)?.async('text')
|
|
512
|
+
if (presRelsXml) {
|
|
513
|
+
loadedZip.file(presRelsPath, presRelsXml.replace(/Target="slideMasters\/slideMaster1\.xml"/g, `Target="${primaryMasterRelTarget}"`))
|
|
514
|
+
}
|
|
515
|
+
}
|
|
505
516
|
for (const [filePath, content] of Object.entries(zipMeta.masterFilesMap)) {
|
|
506
517
|
if (content) {
|
|
507
|
-
|
|
518
|
+
let strContent = content as string
|
|
519
|
+
if (filePath.endsWith('.rels')) {
|
|
520
|
+
strContent = strContent.replace(/Target="\.\.\/theme\/(theme\d+\.xml)"/g, (full, themeFile) => {
|
|
521
|
+
return loadedZip.file(`ppt/theme/${themeFile}`) ? full : 'Target="../theme/theme1.xml"'
|
|
522
|
+
})
|
|
523
|
+
}
|
|
524
|
+
loadedZip.file(filePath, strContent)
|
|
508
525
|
}
|
|
509
526
|
}
|
|
510
527
|
|
|
@@ -512,7 +529,13 @@ async function injectMasterAndLayouts(loadedZip: JSZip, zipMeta: any, slides: Sl
|
|
|
512
529
|
if (zipMeta.layoutFilesMap) {
|
|
513
530
|
for (const [filePath, content] of Object.entries(zipMeta.layoutFilesMap)) {
|
|
514
531
|
if (content) {
|
|
515
|
-
|
|
532
|
+
let strContent = content as string
|
|
533
|
+
if (filePath.endsWith('.rels')) {
|
|
534
|
+
strContent = strContent.replace(/Target="\.\.\/theme\/(theme\d+\.xml)"/g, (full, themeFile) => {
|
|
535
|
+
return loadedZip.file(`ppt/theme/${themeFile}`) ? full : 'Target="../theme/theme1.xml"'
|
|
536
|
+
})
|
|
537
|
+
}
|
|
538
|
+
loadedZip.file(filePath, strContent)
|
|
516
539
|
}
|
|
517
540
|
}
|
|
518
541
|
}
|
|
@@ -537,7 +560,16 @@ async function injectMasterAndLayouts(loadedZip: JSZip, zipMeta: any, slides: Sl
|
|
|
537
560
|
|
|
538
561
|
// 4. 更新 [Content_Types].xml,确保所有 slideLayout 及 tags 均已注册,并清理不存在的幽灵 slideMaster
|
|
539
562
|
let ctXml = await loadedZip.file('[Content_Types].xml')?.async('text')
|
|
540
|
-
if (ctXml) {
|
|
563
|
+
if (ctXml) {
|
|
564
|
+
for (const mf of Object.keys(zipMeta.masterFilesMap)) {
|
|
565
|
+
if (mf.endsWith('.xml') && !mf.includes('_rels')) {
|
|
566
|
+
const partName = '/' + mf
|
|
567
|
+
if (!ctXml.includes(partName)) {
|
|
568
|
+
const override = `<Override PartName="${partName}" ContentType="application/vnd.openxmlformats-officedocument.presentationml.slideMaster+xml"/>`
|
|
569
|
+
ctXml = ctXml.replace('</Types>', override + '</Types>')
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
}
|
|
541
573
|
if (zipMeta.layoutFilesMap) {
|
|
542
574
|
for (const lf of Object.keys(zipMeta.layoutFilesMap)) {
|
|
543
575
|
if (lf.endsWith('.xml') && !lf.includes('_rels')) {
|
|
Binary file
|
|
Binary file
|