diff --git a/src/editor/core/event/CanvasEvent.ts b/src/editor/core/event/CanvasEvent.ts index dfd25df..96a7f37 100644 --- a/src/editor/core/event/CanvasEvent.ts +++ b/src/editor/core/event/CanvasEvent.ts @@ -273,6 +273,7 @@ export class CanvasEvent { const { index } = cursorPosition const { startIndex, endIndex } = this.range.getRange() const isCollapsed = startIndex === endIndex + const element = elementList[index] // 当前激活控件 const isPartRangeInControlOutside = this.control.isPartRangeInControlOutside() const activeControl = this.control.getActiveControl() @@ -299,10 +300,8 @@ export class CanvasEvent { } else if (evt.key === KeyMap.Delete) { if (isReadonly || isPartRangeInControlOutside) return let curIndex: number - if (activeControl) { + if (activeControl && elementList[endIndex + 1]?.controlId === element.controlId) { curIndex = this.control.keydown(evt) - } else if (elementList[endIndex + 1]?.type === ElementType.CONTROL) { - curIndex = this.control.removeControl(endIndex + 1) } else { if (!isCollapsed) { elementList.splice(startIndex + 1, endIndex - startIndex) @@ -522,7 +521,7 @@ export class CanvasEvent { }) // 控件-移除placeholder let curIndex: number - if (activeControl) { + if (activeControl && elementList[endIndex + 1]?.controlId === element.controlId) { curIndex = this.control.setValue(inputData) } else { let start = 0