perf: update pptxtojson v1.2.0

This commit is contained in:
zxc 2025-03-13 21:39:47 +08:00
parent eeb32efc73
commit be5af25aa5
3 changed files with 25 additions and 12 deletions

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.1.1",
"pptxtojson": "^1.2.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.1.1",
"resolved": "https://registry.npmmirror.com/pptxtojson/-/pptxtojson-1.1.1.tgz",
"integrity": "sha512-J8K0BdRTlbVeKGu3tbK8qlSxAc8HKfnsn4ycANBsgPuVvsSEf9VmcmwH/tFJjLZgeoJ0qjo9v780pliAdZ85SA==",
"version": "1.2.0",
"resolved": "https://registry.npmmirror.com/pptxtojson/-/pptxtojson-1.2.0.tgz",
"integrity": "sha512-mDroIVEt6nbsUPI9mrxWzJhU0hNHS614ra/MktMZOMYF5Nh/LwksXRC5J/kr0hZObxa98TqmhUJCktTwcQ2cSg==",
"dependencies": {
"jszip": "^3.10.1",
"tinycolor2": "1.6.0",
@ -8393,9 +8393,9 @@
}
},
"pptxtojson": {
"version": "1.1.1",
"resolved": "https://registry.npmmirror.com/pptxtojson/-/pptxtojson-1.1.1.tgz",
"integrity": "sha512-J8K0BdRTlbVeKGu3tbK8qlSxAc8HKfnsn4ycANBsgPuVvsSEf9VmcmwH/tFJjLZgeoJ0qjo9v780pliAdZ85SA==",
"version": "1.2.0",
"resolved": "https://registry.npmmirror.com/pptxtojson/-/pptxtojson-1.2.0.tgz",
"integrity": "sha512-mDroIVEt6nbsUPI9mrxWzJhU0hNHS614ra/MktMZOMYF5Nh/LwksXRC5J/kr0hZObxa98TqmhUJCktTwcQ2cSg==",
"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.1.1",
"pptxtojson": "^1.2.0",
"prosemirror-commands": "^1.6.0",
"prosemirror-dropcursor": "^1.8.1",
"prosemirror-gapcursor": "^1.3.2",

View File

@ -21,6 +21,7 @@ import type {
ShapeTextAlign,
PPTTextElement,
ChartOptions,
Gradient,
} from '@/types/slides'
const convertFontSizePtToPx = (html: string, ratio: number) => {
@ -227,7 +228,7 @@ export default () => {
width: el.borderWidth,
style: el.borderType,
},
fill: el.fillColor,
fill: el.fill.type === 'color' ? el.fill.value : '',
vertical: el.isVertical,
}
if (el.shadow) {
@ -297,6 +298,17 @@ export default () => {
'down': 'bottom',
'up': 'top',
}
const gradient: Gradient | undefined = el.fill?.type === 'gradient' ? {
type: 'linear',
colors: el.fill.value.colors.map(item => ({
...item,
pos: parseInt(item.pos),
})),
rotate: el.fill.value.rot,
} : undefined
const fill = el.fill?.type === 'color' ? el.fill.value : ''
const element: PPTShapeElement = {
type: 'shape',
@ -307,7 +319,8 @@ export default () => {
top: el.top,
viewBox: [200, 200],
path: 'M 0 0 L 200 0 L 200 200 L 0 200 Z',
fill: el.fillColor || 'none',
fill: fill || 'none',
gradient,
fixedRatio: false,
rotate: el.rotate,
outline: {
@ -491,7 +504,7 @@ export default () => {
left: el.left,
top: el.top,
rotate: 0,
themeColors: [theme.value.themeColor],
themeColors: el.colors.length ? el.colors : [theme.value.themeColor],
textColor: theme.value.fontColor,
data: {
labels,
@ -530,7 +543,7 @@ export default () => {
}
}
}
parseElements(item.elements)
parseElements([...item.elements, ...item.layoutElements])
slides.push(slide)
}