chore: update pptxtojson v1.3.0

This commit is contained in:
zxc 2025-03-30 20:48:58 +08:00
parent 58c1ca0600
commit c87f9d99b8
5 changed files with 38 additions and 26 deletions

View File

@ -198,10 +198,9 @@ If you wish to use this project for commercial gain, I hope you will respect ope
- 你给本项目提交过重要的 PR 并且被合并(由作者主观判断);
- 你长期参与到本项目的维护/推进工作中,如为本项目:提供了有效的周边工具、制作了大量模板等(由作者主观判断);
3. [邮件联系作者](mailto:pipipi_pikachu@163.com)付费获取独立的商业授权。独立授权价格:
- 一年1999无发票
- 三年2999无发票
- 永久5499无发票
- 永久6999可开电子发票
- 一年19992599可开具电子发票
- 三年29993999可开具电子发票
- 永久54997499可开具电子发票
- 如需付费获取独立的商业授权,请注意:
- 独立商业授权的意思是:单独授权您将代码用于商业行为,且不必执行 AGPL-3.0 协议;
- 不提供额外的“高级版本”和技术支持,也不提供可直接交付的产品;

View File

@ -182,10 +182,9 @@ npm run dev
- 你给本项目提交过重要的 PR 并且被合并(由作者主观判断);
- 你长期参与到本项目的维护/推进工作中,如为本项目:提供了有效的周边工具、制作了大量模板等(由作者主观判断);
3. [邮件联系作者](mailto:pipipi_pikachu@163.com)付费获取独立的商业授权。独立授权价格:
- 一年1999无发票
- 三年2999无发票
- 永久5499无发票
- 永久6999可开电子发票
- 一年19992599可开具电子发票
- 三年29993999可开具电子发票
- 永久54997499可开具电子发票
- 如需付费获取独立的商业授权,请注意:
- 独立商业授权的意思是:单独授权您将代码用于商业行为,且不必执行 AGPL-3.0 协议;
- 不提供额外的“高级版本”和技术支持,也不提供可直接交付的产品;

14
package-lock.json generated
View File

@ -24,7 +24,7 @@
"number-precision": "^1.6.0",
"pinia": "^2.1.7",
"pptxgenjs": "^3.12.0",
"pptxtojson": "^1.2.2",
"pptxtojson": "^1.3.0",
"prosemirror-commands": "^1.6.0",
"prosemirror-dropcursor": "^1.8.1",
"prosemirror-gapcursor": "^1.3.2",
@ -4177,9 +4177,9 @@
}
},
"node_modules/pptxtojson": {
"version": "1.2.2",
"resolved": "https://registry.npmmirror.com/pptxtojson/-/pptxtojson-1.2.2.tgz",
"integrity": "sha512-F50uJ+3I3az7DB9+6R+OsWWT8YLdnuDWjwo88cGnOprlPWqrpuRq6inXxL1oSwBICJmZbuN+3RJwrtarvp133w==",
"version": "1.3.0",
"resolved": "https://registry.npmmirror.com/pptxtojson/-/pptxtojson-1.3.0.tgz",
"integrity": "sha512-bLV7v+feumB08iMCRT2JORKpa95Pl54t5LyfweYHwvRxhT3BUSr1Qw3Kz4cx5l/EDKF0LElphPodxxvYjwgu5w==",
"dependencies": {
"jszip": "^3.10.1",
"tinycolor2": "1.6.0",
@ -8393,9 +8393,9 @@
}
},
"pptxtojson": {
"version": "1.2.2",
"resolved": "https://registry.npmmirror.com/pptxtojson/-/pptxtojson-1.2.2.tgz",
"integrity": "sha512-F50uJ+3I3az7DB9+6R+OsWWT8YLdnuDWjwo88cGnOprlPWqrpuRq6inXxL1oSwBICJmZbuN+3RJwrtarvp133w==",
"version": "1.3.0",
"resolved": "https://registry.npmmirror.com/pptxtojson/-/pptxtojson-1.3.0.tgz",
"integrity": "sha512-bLV7v+feumB08iMCRT2JORKpa95Pl54t5LyfweYHwvRxhT3BUSr1Qw3Kz4cx5l/EDKF0LElphPodxxvYjwgu5w==",
"requires": {
"jszip": "^3.10.1",
"tinycolor2": "1.6.0",

View File

@ -29,7 +29,7 @@
"number-precision": "^1.6.0",
"pinia": "^2.1.7",
"pptxgenjs": "^3.12.0",
"pptxtojson": "^1.2.2",
"pptxtojson": "^1.3.0",
"prosemirror-commands": "^1.6.0",
"prosemirror-dropcursor": "^1.8.1",
"prosemirror-gapcursor": "^1.3.2",

View File

@ -66,7 +66,7 @@ export default () => {
reader.readAsText(file)
}
const parseLineElement = (el: Shape) => {
const parseLineElement = (el: Shape, ratio: number) => {
let start: [number, number] = [0, 0]
let end: [number, number] = [0, 0]
@ -90,7 +90,7 @@ export default () => {
const data: PPTLineElement = {
type: 'line',
id: nanoid(10),
width: el.borderWidth || 1,
width: +((el.borderWidth || 1) * ratio).toFixed(2),
left: el.left,
top: el.top,
start,
@ -242,7 +242,7 @@ export default () => {
lineHeight: 1,
outline: {
color: el.borderColor,
width: el.borderWidth,
width: +(el.borderWidth * ratio).toFixed(2),
style: el.borderType,
},
fill: el.fill.type === 'color' ? el.fill.value : '',
@ -317,7 +317,7 @@ export default () => {
}
else if (el.type === 'shape') {
if (el.shapType === 'line' || /Connector/.test(el.shapType)) {
const lineElement = parseLineElement(el)
const lineElement = parseLineElement(el, ratio)
slide.elements.push(lineElement)
}
else {
@ -358,7 +358,7 @@ export default () => {
rotate: el.rotate,
outline: {
color: el.borderColor,
width: el.borderWidth,
width: +(el.borderWidth * ratio).toFixed(2),
style: el.borderType,
},
text: {
@ -453,7 +453,21 @@ export default () => {
data.push(rowCells)
}
const colWidths: number[] = new Array(col).fill(1 / col)
const allWidth = el.colWidths.reduce((a, b) => a + b, 0)
const colWidths: number[] = el.colWidths.map(item => item / allWidth)
const firstCell = el.data[0][0]
const border = firstCell.borders.top ||
firstCell.borders.bottom ||
el.borders.top ||
el.borders.bottom ||
firstCell.borders.left ||
firstCell.borders.right ||
el.borders.left ||
el.borders.right
const borderWidth = border?.borderWidth || 0
const borderStyle = border?.borderType || 'solid'
const borderColor = border?.borderColor || '#eeece1'
slide.elements.push({
type: 'table',
@ -466,11 +480,11 @@ export default () => {
rotate: 0,
data,
outline: {
width: el.borderWidth || 2,
style: el.borderType,
color: el.borderColor || '#eeece1',
width: +(borderWidth * ratio || 2).toFixed(2),
style: borderStyle,
color: borderColor,
},
cellMinHeight: 36,
cellMinHeight: el.rowHeights[0] ? el.rowHeights[0] * ratio : 36,
})
}
else if (el.type === 'chart') {