fix:event error at control boundary
This commit is contained in:
@@ -273,6 +273,7 @@ export class CanvasEvent {
|
|||||||
const { index } = cursorPosition
|
const { index } = cursorPosition
|
||||||
const { startIndex, endIndex } = this.range.getRange()
|
const { startIndex, endIndex } = this.range.getRange()
|
||||||
const isCollapsed = startIndex === endIndex
|
const isCollapsed = startIndex === endIndex
|
||||||
|
const element = elementList[index]
|
||||||
// 当前激活控件
|
// 当前激活控件
|
||||||
const isPartRangeInControlOutside = this.control.isPartRangeInControlOutside()
|
const isPartRangeInControlOutside = this.control.isPartRangeInControlOutside()
|
||||||
const activeControl = this.control.getActiveControl()
|
const activeControl = this.control.getActiveControl()
|
||||||
@@ -299,10 +300,8 @@ export class CanvasEvent {
|
|||||||
} else if (evt.key === KeyMap.Delete) {
|
} else if (evt.key === KeyMap.Delete) {
|
||||||
if (isReadonly || isPartRangeInControlOutside) return
|
if (isReadonly || isPartRangeInControlOutside) return
|
||||||
let curIndex: number
|
let curIndex: number
|
||||||
if (activeControl) {
|
if (activeControl && elementList[endIndex + 1]?.controlId === element.controlId) {
|
||||||
curIndex = this.control.keydown(evt)
|
curIndex = this.control.keydown(evt)
|
||||||
} else if (elementList[endIndex + 1]?.type === ElementType.CONTROL) {
|
|
||||||
curIndex = this.control.removeControl(endIndex + 1)
|
|
||||||
} else {
|
} else {
|
||||||
if (!isCollapsed) {
|
if (!isCollapsed) {
|
||||||
elementList.splice(startIndex + 1, endIndex - startIndex)
|
elementList.splice(startIndex + 1, endIndex - startIndex)
|
||||||
@@ -522,7 +521,7 @@ export class CanvasEvent {
|
|||||||
})
|
})
|
||||||
// 控件-移除placeholder
|
// 控件-移除placeholder
|
||||||
let curIndex: number
|
let curIndex: number
|
||||||
if (activeControl) {
|
if (activeControl && elementList[endIndex + 1]?.controlId === element.controlId) {
|
||||||
curIndex = this.control.setValue(inputData)
|
curIndex = this.control.setValue(inputData)
|
||||||
} else {
|
} else {
|
||||||
let start = 0
|
let start = 0
|
||||||
|
|||||||
Reference in New Issue
Block a user