From 86558e500177053961c124739630b649b9234851 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=A6=E5=B0=91=E5=8D=AB?= Date: Thu, 25 Jul 2024 16:49:55 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E7=BB=84=E5=86=85=E6=96=87=E5=AD=97):=20?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E5=85=B6=E4=BB=96=E5=B1=9E=E6=80=A7=E5=90=8E?= =?UTF-8?q?=E4=B8=8D=E7=94=9F=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/core/plugin/GroupTextEditorPlugin.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/packages/core/plugin/GroupTextEditorPlugin.ts b/packages/core/plugin/GroupTextEditorPlugin.ts index 3b7009fd..e79032f6 100644 --- a/packages/core/plugin/GroupTextEditorPlugin.ts +++ b/packages/core/plugin/GroupTextEditorPlugin.ts @@ -2,7 +2,7 @@ * @Author: 秦少卫 * @Date: 2023-06-22 16:11:40 * @LastEditors: 秦少卫 - * @LastEditTime: 2024-04-10 17:33:22 + * @LastEditTime: 2024-07-25 16:49:18 * @Description: 组内文字编辑 */ @@ -10,6 +10,7 @@ import { fabric } from 'fabric'; import Editor from '../Editor'; import { isGroup } from '../utils/utils'; import { v4 as uuid } from 'uuid'; +import { pick } from 'lodash-es'; type IEditor = Editor; class GroupTextEditorPlugin implements IPluginTempl { @@ -116,8 +117,18 @@ class GroupTextEditorPlugin implements IPluginTempl { tempText.selectAll(); tempText.on('editing:exited', () => { + const attrs = tempText.toObject(); + // 进入编辑模式时触发 textObject.set({ + ...pick(attrs, [ + 'fill', + 'fontSize', + 'fontStyle', + 'fontFamily', + 'lineHeight', + 'backgroundColor', + ]), text: tempText.text, visible: true, });