Skip to content

Commit

Permalink
fix: clear control content boundary error #988
Browse files Browse the repository at this point in the history
  • Loading branch information
Hufe921 committed Feb 6, 2025
1 parent b3c6259 commit 635f7f0
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 13 deletions.
36 changes: 24 additions & 12 deletions src/editor/core/draw/control/Control.ts
Original file line number Diff line number Diff line change
Expand Up @@ -929,14 +929,20 @@ export class Control {
isIgnoreDisabledRule: true
}
if (type === ControlType.TEXT) {
const formatValue = Array.isArray(value) ? value : [{ value }]
formatElementList(formatValue, {
isHandleFirstElement: false,
editorOptions: this.options
})
const formatValue = Array.isArray(value)
? value
: value
? [{ value }]
: []
if (formatValue.length) {
formatElementList(formatValue, {
isHandleFirstElement: false,
editorOptions: this.options
})
}
const text = new TextControl(element, this)
this.activeControl = text
if (value) {
if (formatValue.length) {
text.setValue(formatValue, controlContext, controlRule)
} else {
text.clearValue(controlContext, controlRule)
Expand Down Expand Up @@ -972,14 +978,20 @@ export class Control {
date.clearSelect(controlContext, controlRule)
}
} else if (type === ControlType.NUMBER) {
const formatValue = Array.isArray(value) ? value : [{ value }]
formatElementList(formatValue, {
isHandleFirstElement: false,
editorOptions: this.options
})
const formatValue = Array.isArray(value)
? value
: value
? [{ value }]
: []
if (formatValue.length) {
formatElementList(formatValue, {
isHandleFirstElement: false,
editorOptions: this.options
})
}
const text = new NumberControl(element, this)
this.activeControl = text
if (value) {
if (formatValue.length) {
text.setValue(formatValue, controlContext, controlRule)
} else {
text.clearValue(controlContext, controlRule)
Expand Down
2 changes: 1 addition & 1 deletion src/editor/interface/Control.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ export interface ISetControlValueOption {
id?: string
conceptId?: string
areaId?: string
value: string | IElement[]
value: string | IElement[] | null
isSubmitHistory?: boolean
}

Expand Down

0 comments on commit 635f7f0

Please sign in to comment.