pptxtojson 1.2.1 → 1.2.2
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.md +4 -3
- 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/package.json +1 -1
- package/src/pptxtojson.js +12 -5
- package/src/shape.js +1 -1
package/package.json
CHANGED
package/src/pptxtojson.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import JSZip from 'jszip'
|
|
2
2
|
import { readXmlFile } from './readXmlFile'
|
|
3
3
|
import { getBorder } from './border'
|
|
4
|
-
import { getSlideBackgroundFill, getShapeFill, getSolidFill } from './fill'
|
|
4
|
+
import { getSlideBackgroundFill, getShapeFill, getSolidFill, getPicFill } from './fill'
|
|
5
5
|
import { getChartInfo } from './chart'
|
|
6
6
|
import { getVerticalAlign } from './align'
|
|
7
7
|
import { getPosition, getSize } from './position'
|
|
@@ -414,7 +414,7 @@ async function processNodesInSlide(nodeKey, nodeValue, warpObj, source) {
|
|
|
414
414
|
json = await processGroupSpNode(getTextByPathList(nodeValue, ['mc:Fallback']), warpObj, source)
|
|
415
415
|
}
|
|
416
416
|
else if (getTextByPathList(nodeValue, ['mc:Choice'])) {
|
|
417
|
-
json = processMathNode(
|
|
417
|
+
json = await processMathNode(nodeValue, warpObj, source)
|
|
418
418
|
}
|
|
419
419
|
break
|
|
420
420
|
default:
|
|
@@ -423,15 +423,21 @@ async function processNodesInSlide(nodeKey, nodeValue, warpObj, source) {
|
|
|
423
423
|
return json
|
|
424
424
|
}
|
|
425
425
|
|
|
426
|
-
function processMathNode(node) {
|
|
426
|
+
async function processMathNode(node, warpObj, source) {
|
|
427
|
+
const choice = getTextByPathList(node, ['mc:Choice'])
|
|
428
|
+
const fallback = getTextByPathList(node, ['mc:Fallback'])
|
|
429
|
+
|
|
427
430
|
const order = node['attrs']['order']
|
|
428
|
-
const xfrmNode = getTextByPathList(
|
|
431
|
+
const xfrmNode = getTextByPathList(choice, ['p:sp', 'p:spPr', 'a:xfrm'])
|
|
429
432
|
const { top, left } = getPosition(xfrmNode, undefined, undefined)
|
|
430
433
|
const { width, height } = getSize(xfrmNode, undefined, undefined)
|
|
431
434
|
|
|
432
|
-
const oMath = findOMath(
|
|
435
|
+
const oMath = findOMath(choice)[0]
|
|
433
436
|
const latex = latexFormart(parseOMath(oMath))
|
|
434
437
|
|
|
438
|
+
const blipFill = getTextByPathList(fallback, ['p:sp', 'p:spPr', 'a:blipFill'])
|
|
439
|
+
const picBase64 = await getPicFill(source, blipFill, warpObj)
|
|
440
|
+
|
|
435
441
|
return {
|
|
436
442
|
type: 'math',
|
|
437
443
|
top,
|
|
@@ -439,6 +445,7 @@ function processMathNode(node) {
|
|
|
439
445
|
width,
|
|
440
446
|
height,
|
|
441
447
|
latex,
|
|
448
|
+
picBase64,
|
|
442
449
|
order,
|
|
443
450
|
}
|
|
444
451
|
}
|
package/src/shape.js
CHANGED
|
@@ -35,7 +35,7 @@ export function getCustomShapePath(custShapType, w, h) {
|
|
|
35
35
|
const pathLstNode = getTextByPathList(custShapType, ['a:pathLst'])
|
|
36
36
|
let pathNodes = getTextByPathList(pathLstNode, ['a:path'])
|
|
37
37
|
|
|
38
|
-
if (Array.isArray(pathNodes)) pathNodes = pathNodes.
|
|
38
|
+
if (Array.isArray(pathNodes)) pathNodes = pathNodes.shift()
|
|
39
39
|
|
|
40
40
|
const maxX = parseInt(pathNodes['attrs']['w'])
|
|
41
41
|
const maxY = parseInt(pathNodes['attrs']['h'])
|