From d901fffd87ed652e2c29a62cb33d5f1538242455 Mon Sep 17 00:00:00 2001 From: pipipi-pikachu Date: Sun, 15 Oct 2023 16:38:06 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=A0=BC=E5=BC=8F=E5=88=B7=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E5=8F=8C=E5=87=BB=E8=BF=9E=E7=BB=AD=E4=BD=BF=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hooks/useShapeFormatPainter.ts | 3 ++- src/hooks/useTextFormatPainter.ts | 3 ++- src/types/edit.ts | 2 ++ .../Editor/Toolbar/ElementStylePanel/ShapeStylePanel.vue | 5 ++++- .../Editor/Toolbar/ElementStylePanel/TextStylePanel.vue | 3 ++- src/views/components/element/ProsemirrorEditor.vue | 5 +++-- src/views/components/element/ShapeElement/index.vue | 6 ++++-- 7 files changed, 19 insertions(+), 8 deletions(-) diff --git a/src/hooks/useShapeFormatPainter.ts b/src/hooks/useShapeFormatPainter.ts index 6cf50d1f..362e0594 100644 --- a/src/hooks/useShapeFormatPainter.ts +++ b/src/hooks/useShapeFormatPainter.ts @@ -6,12 +6,13 @@ export default () => { const mainStore = useMainStore() const { shapeFormatPainter, handleElement } = storeToRefs(mainStore) - const toggleShapeFormatPainter = () => { + const toggleShapeFormatPainter = (keep = false) => { const _handleElement = handleElement.value as PPTShapeElement if (shapeFormatPainter.value) mainStore.setShapeFormatPainter(null) else { mainStore.setShapeFormatPainter({ + keep, fill: _handleElement.fill, gradient: _handleElement.gradient, outline: _handleElement.outline, diff --git a/src/hooks/useTextFormatPainter.ts b/src/hooks/useTextFormatPainter.ts index 9e752c56..6eaeb86f 100644 --- a/src/hooks/useTextFormatPainter.ts +++ b/src/hooks/useTextFormatPainter.ts @@ -5,10 +5,11 @@ export default () => { const mainStore = useMainStore() const { richTextAttrs, textFormatPainter } = storeToRefs(mainStore) - const toggleTextFormatPainter = () => { + const toggleTextFormatPainter = (keep = false) => { if (textFormatPainter.value) mainStore.setTextFormatPainter(null) else { mainStore.setTextFormatPainter({ + keep, bold: richTextAttrs.value.bold, em: richTextAttrs.value.em, underline: richTextAttrs.value.underline, diff --git a/src/types/edit.ts b/src/types/edit.ts index cc93fda3..398add4a 100644 --- a/src/types/edit.ts +++ b/src/types/edit.ts @@ -102,6 +102,7 @@ export type CreatingElement = CreatingTextElement | CreatingShapeElement | Creat export type TextFormatPainterKeys = 'bold' | 'em' | 'underline' | 'strikethrough' | 'color' | 'backcolor' | 'fontsize' | 'fontname' | 'align' export interface TextFormatPainter { + keep: boolean bold?: boolean em?: boolean underline?: boolean @@ -114,6 +115,7 @@ export interface TextFormatPainter { } export interface ShapeFormatPainter { + keep: boolean fill?: string gradient?: ShapeGradient outline?: PPTElementOutline diff --git a/src/views/Editor/Toolbar/ElementStylePanel/ShapeStylePanel.vue b/src/views/Editor/Toolbar/ElementStylePanel/ShapeStylePanel.vue index 77587f9e..d6f65ce1 100644 --- a/src/views/Editor/Toolbar/ElementStylePanel/ShapeStylePanel.vue +++ b/src/views/Editor/Toolbar/ElementStylePanel/ShapeStylePanel.vue @@ -198,8 +198,9 @@ @@ -239,9 +240,11 @@
形状格式刷
diff --git a/src/views/Editor/Toolbar/ElementStylePanel/TextStylePanel.vue b/src/views/Editor/Toolbar/ElementStylePanel/TextStylePanel.vue index d58c3783..ab514aba 100644 --- a/src/views/Editor/Toolbar/ElementStylePanel/TextStylePanel.vue +++ b/src/views/Editor/Toolbar/ElementStylePanel/TextStylePanel.vue @@ -143,8 +143,9 @@