From d89d1110f55de5743d78d5266783585a484976e5 Mon Sep 17 00:00:00 2001 From: pipipi-pikachu Date: Thu, 9 Jan 2025 20:22:40 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E5=9B=BE=E7=89=87?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E6=A0=87=E8=AE=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hooks/useAIPPT.ts | 10 ++++---- src/types/slides.ts | 5 ++++ src/views/Editor/MarkupPanel.vue | 42 ++++++++++++++++++++++++++++---- 3 files changed, 47 insertions(+), 10 deletions(-) diff --git a/src/hooks/useAIPPT.ts b/src/hooks/useAIPPT.ts index 0cc5e18f..7518edf6 100644 --- a/src/hooks/useAIPPT.ts +++ b/src/hooks/useAIPPT.ts @@ -299,7 +299,7 @@ export default () => { for (const item of AISlides) { if (item.type === 'cover') { const elements = coverTemplate.elements.map(el => { - if (el.type === 'image' && !el.lock && imgPool.value.length) return getNewImgElement(el) + if (el.type === 'image' && el.imageType && imgPool.value.length) return getNewImgElement(el) if (el.type !== 'text' && el.type !== 'shape') return el if (checkTextType(el, 'title') && item.data.title) { return getNewTextElement({ el, text: item.data.title, maxLine: 1 }) @@ -334,7 +334,7 @@ export default () => { const longestText = item.data.items.reduce((longest, current) => current.length > longest.length ? current : longest, '') const elements = contentsTemplate.elements.map(el => { - if (el.type === 'image' && !el.lock && imgPool.value.length) return getNewImgElement(el) + if (el.type === 'image' && el.imageType && imgPool.value.length) return getNewImgElement(el) if (el.type !== 'text' && el.type !== 'shape') return el if (checkTextType(el, 'item')) { const index = sortedItemIds.findIndex(id => id === el.id) @@ -357,7 +357,7 @@ export default () => { else if (item.type === 'transition') { transitionIndex++ const elements = transitionTemplate.elements.map(el => { - if (el.type === 'image' && !el.lock && imgPool.value.length) return getNewImgElement(el) + if (el.type === 'image' && el.imageType && imgPool.value.length) return getNewImgElement(el) if (el.type !== 'text' && el.type !== 'shape') return el if (checkTextType(el, 'title') && item.data.title) { return getNewTextElement({ el, text: item.data.title, maxLine: 1 }) @@ -409,7 +409,7 @@ export default () => { const longestText = itemTexts.reduce((longest, current) => current.length > longest.length ? current : longest, '') const elements = contentTemplate.elements.map(el => { - if (el.type === 'image' && !el.lock && imgPool.value.length) return getNewImgElement(el) + if (el.type === 'image' && el.imageType && imgPool.value.length) return getNewImgElement(el) if (el.type !== 'text' && el.type !== 'shape') return el if (item.data.items.length === 1) { const contentItem = item.data.items[0] @@ -451,7 +451,7 @@ export default () => { } else if (item.type === 'end') { const elements = endTemplate.elements.map(el => { - if (el.type === 'image' && !el.lock && imgPool.value.length) return getNewImgElement(el) + if (el.type === 'image' && el.imageType && imgPool.value.length) return getNewImgElement(el) return el }) slides.push({ diff --git a/src/types/slides.ts b/src/types/slides.ts index 3aa618a6..33e5eb49 100644 --- a/src/types/slides.ts +++ b/src/types/slides.ts @@ -245,6 +245,8 @@ export interface ImageElementClip { shape: string } +export type ImageType = 'pageFigure' | 'itemFigure' | 'background' + /** * 图片元素 * @@ -269,6 +271,8 @@ export interface ImageElementClip { * radius?: 圆角半径 * * colorMask?: 颜色蒙版 + * + * imageType?: 图片类型 */ export interface PPTImageElement extends PPTBaseElement { type: 'image' @@ -282,6 +286,7 @@ export interface PPTImageElement extends PPTBaseElement { shadow?: PPTElementShadow radius?: number colorMask?: string + imageType?: ImageType } export type ShapeTextAlign = 'top' | 'middle' | 'bottom' diff --git a/src/views/Editor/MarkupPanel.vue b/src/views/Editor/MarkupPanel.vue index 394ca8d9..9f6a9e89 100644 --- a/src/views/Editor/MarkupPanel.vue +++ b/src/views/Editor/MarkupPanel.vue @@ -27,7 +27,16 @@ :options="textTypeOptions" /> -
选中文本框或带文本的形状,标记文本类型
+
+
当前图片类型:
+