pptxtojson 1.3.1 → 1.3.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pptxtojson",
3
- "version": "1.3.1",
3
+ "version": "1.3.2",
4
4
  "description": "A javascript tool for parsing .pptx file",
5
5
  "type": "module",
6
6
  "main": "./dist/index.umd.js",
package/src/pptxtojson.js CHANGED
@@ -612,12 +612,14 @@ async function genShape(node, pNode, slideLayoutSpNode, slideMasterSpNode, name,
612
612
 
613
613
  if (shadow) data.shadow = shadow
614
614
 
615
+ const isHasValidText = data.content && hasValidText(data.content)
616
+
615
617
  if (custShapType && type !== 'diagram') {
616
618
  const ext = getTextByPathList(slideXfrmNode, ['a:ext', 'attrs'])
617
619
  const w = parseInt(ext['cx']) * RATIO_EMUs_Points
618
620
  const h = parseInt(ext['cy']) * RATIO_EMUs_Points
619
621
  const d = getCustomShapePath(custShapType, w, h)
620
- if (data.content && !hasValidText(data.content)) data.content = ''
622
+ if (!isHasValidText) data.content = ''
621
623
 
622
624
  return {
623
625
  ...data,
@@ -626,11 +628,19 @@ async function genShape(node, pNode, slideLayoutSpNode, slideMasterSpNode, name,
626
628
  path: d,
627
629
  }
628
630
  }
629
- if (shapType && (type === 'obj' || !type)) {
630
- if (data.content && !hasValidText(data.content)) data.content = ''
631
+ if (shapType && (type === 'obj' || !type || shapType !== 'rect')) {
632
+ if (!isHasValidText) data.content = ''
633
+ return {
634
+ ...data,
635
+ type: 'shape',
636
+ shapType,
637
+ }
638
+ }
639
+ if (shapType && !isHasValidText && (fill || borderWidth)) {
631
640
  return {
632
641
  ...data,
633
642
  type: 'shape',
643
+ content: '',
634
644
  shapType,
635
645
  }
636
646
  }
package/src/shadow.js CHANGED
@@ -5,7 +5,7 @@ export function getShadow(node, warpObj) {
5
5
  const chdwClrNode = getSolidFill(node, undefined, undefined, warpObj)
6
6
  const outerShdwAttrs = node['attrs']
7
7
  const dir = outerShdwAttrs['dir'] ? (parseInt(outerShdwAttrs['dir']) / 60000) : 0
8
- const dist = parseInt(outerShdwAttrs['dist']) * RATIO_EMUs_Points
8
+ const dist = outerShdwAttrs['dist'] ? parseInt(outerShdwAttrs['dist']) * RATIO_EMUs_Points : 0
9
9
  const blurRad = outerShdwAttrs['blurRad'] ? parseInt(outerShdwAttrs['blurRad']) * RATIO_EMUs_Points : ''
10
10
  const vx = dist * Math.sin(dir * Math.PI / 180)
11
11
  const hx = dist * Math.cos(dir * Math.PI / 180)