pptxtojson 1.2.0 → 1.2.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/dist/index.d.ts +1 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/dist/wx.png +0 -0
- package/package.json +1 -1
- package/src/border.js +12 -2
- package/src/fill.js +16 -4
- package/src/pptxtojson.js +5 -1
package/dist/wx.png
CHANGED
|
Binary file
|
package/package.json
CHANGED
package/src/border.js
CHANGED
|
@@ -3,9 +3,19 @@ import { getSchemeColorFromTheme } from './schemeColor'
|
|
|
3
3
|
import { getTextByPathList } from './utils'
|
|
4
4
|
|
|
5
5
|
export function getBorder(node, elType, warpObj) {
|
|
6
|
-
|
|
6
|
+
let lineNode = node['p:spPr']['a:ln']
|
|
7
|
+
if (!lineNode) {
|
|
8
|
+
const lnRefNode = getTextByPathList(node, ['p:style', 'a:lnRef'])
|
|
9
|
+
if (lnRefNode) {
|
|
10
|
+
const lnIdx = getTextByPathList(lnRefNode, ['attrs', 'idx'])
|
|
11
|
+
lineNode = warpObj['themeContent']['a:theme']['a:themeElements']['a:fmtScheme']['a:lnStyleLst']['a:ln'][Number(lnIdx) - 1]
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
if (!lineNode) lineNode = node
|
|
15
|
+
|
|
16
|
+
const isNoFill = getTextByPathList(lineNode, ['a:noFill'])
|
|
7
17
|
|
|
8
|
-
let borderWidth = parseInt(getTextByPathList(lineNode, ['attrs', 'w'])) / 12700
|
|
18
|
+
let borderWidth = isNoFill ? 0 : (parseInt(getTextByPathList(lineNode, ['attrs', 'w'])) / 12700)
|
|
9
19
|
if (isNaN(borderWidth)) {
|
|
10
20
|
if (lineNode) borderWidth = 0
|
|
11
21
|
else if (elType !== 'obj') borderWidth = 0
|
package/src/fill.js
CHANGED
|
@@ -112,10 +112,16 @@ export function getGradientFill(node, warpObj) {
|
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
114
|
const lin = node['a:lin']
|
|
115
|
-
let rot =
|
|
116
|
-
|
|
115
|
+
let rot = 0
|
|
116
|
+
let pathType = 'line'
|
|
117
|
+
if (lin) rot = angleToDegrees(lin['attrs']['ang'])
|
|
118
|
+
else {
|
|
119
|
+
const path = node['a:path']
|
|
120
|
+
if (path && path['attrs'] && path['attrs']['path']) pathType = path['attrs']['path']
|
|
121
|
+
}
|
|
117
122
|
return {
|
|
118
123
|
rot,
|
|
124
|
+
path: pathType,
|
|
119
125
|
colors: colors.sort((a, b) => parseInt(a.pos) - parseInt(b.pos)),
|
|
120
126
|
}
|
|
121
127
|
}
|
|
@@ -136,10 +142,16 @@ export function getBgGradientFill(bgPr, phClr, slideMasterContent, warpObj) {
|
|
|
136
142
|
}
|
|
137
143
|
}
|
|
138
144
|
const lin = grdFill['a:lin']
|
|
139
|
-
let rot =
|
|
140
|
-
|
|
145
|
+
let rot = 0
|
|
146
|
+
let pathType = 'line'
|
|
147
|
+
if (lin) rot = angleToDegrees(lin['attrs']['ang']) + 0
|
|
148
|
+
else {
|
|
149
|
+
const path = grdFill['a:path']
|
|
150
|
+
if (path && path['attrs'] && path['attrs']['path']) pathType = path['attrs']['path']
|
|
151
|
+
}
|
|
141
152
|
return {
|
|
142
153
|
rot,
|
|
154
|
+
path: pathType,
|
|
143
155
|
colors: colors.sort((a, b) => parseInt(a.pos) - parseInt(b.pos)),
|
|
144
156
|
}
|
|
145
157
|
}
|
package/src/pptxtojson.js
CHANGED
|
@@ -949,7 +949,11 @@ async function genChart(node, warpObj) {
|
|
|
949
949
|
const { width, height } = getSize(xfrmNode, undefined, undefined)
|
|
950
950
|
|
|
951
951
|
const rid = node['a:graphic']['a:graphicData']['c:chart']['attrs']['r:id']
|
|
952
|
-
|
|
952
|
+
let refName = getTextByPathList(warpObj['slideResObj'], [rid, 'target'])
|
|
953
|
+
if (!refName) refName = getTextByPathList(warpObj['layoutResObj'], [rid, 'target'])
|
|
954
|
+
if (!refName) refName = getTextByPathList(warpObj['masterResObj'], [rid, 'target'])
|
|
955
|
+
if (!refName) return {}
|
|
956
|
+
|
|
953
957
|
const content = await readXmlFile(warpObj['zip'], refName)
|
|
954
958
|
const plotArea = getTextByPathList(content, ['c:chartSpace', 'c:chart', 'c:plotArea'])
|
|
955
959
|
|