Skip to content

Commit

Permalink
fix: add control placeholder using default style #691
Browse files Browse the repository at this point in the history
  • Loading branch information
Hufe921 committed Jul 11, 2024
1 parent e5b3d05 commit eb3ea5e
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/editor/core/draw/control/Control.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,13 @@ import { IEditorData, IEditorOption } from '../../../interface/Editor'
import { IElement, IElementPosition } from '../../../interface/Element'
import { EventBusMap } from '../../../interface/EventBus'
import { IRange } from '../../../interface/Range'
import { deepClone, nextTick, omitObject, splitText } from '../../../utils'
import {
deepClone,
nextTick,
omitObject,
pickObject,
splitText
} from '../../../utils'
import {
formatElementContext,
formatElementList,
Expand Down Expand Up @@ -510,9 +516,12 @@ export class Control {
const control = startElement.control!
if (!control.placeholder) return
const placeholderStrList = splitText(control.placeholder)
// 优先使用默认控件样式
const anchorElementStyleAttr = pickObject(startElement, CONTROL_STYLE_ATTR)
for (let p = 0; p < placeholderStrList.length; p++) {
const value = placeholderStrList[p]
const newElement: IElement = {
...anchorElementStyleAttr,
value,
controlId: startElement.controlId,
type: ElementType.CONTROL,
Expand Down

0 comments on commit eb3ea5e

Please sign in to comment.