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

View File

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

View File

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