From 7b5079c9b638730f7ea609239b3cb91b915d4650 Mon Sep 17 00:00:00 2001 From: Hufe921 Date: Sat, 22 Jun 2024 22:45:55 +0800 Subject: [PATCH] fix: set default style for control using executeSetControlProperties #658 --- src/editor/core/draw/control/Control.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/editor/core/draw/control/Control.ts b/src/editor/core/draw/control/Control.ts index 5729709..ff0bb9d 100644 --- a/src/editor/core/draw/control/Control.ts +++ b/src/editor/core/draw/control/Control.ts @@ -42,6 +42,7 @@ import { SelectControl } from './select/SelectControl' import { TextControl } from './text/TextControl' import { DateControl } from './date/DateControl' import { MoveDirection } from '../../../dataset/enum/Observer' +import { CONTROL_STYLE_ATTR } from '../../../dataset/constant/Element' interface IMoveCursorResult { newIndex: number @@ -815,6 +816,13 @@ export class Control { ...properties, value: element.control.value } + // 控件默认样式 + CONTROL_STYLE_ATTR.forEach(key => { + const controlStyleProperty = properties[key] + if (controlStyleProperty) { + Reflect.set(element, key, controlStyleProperty) + } + }) // 修改后控件结束索引 let newEndIndex = i while (newEndIndex < elementList.length) {