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, });