|
|
|
@ -340,11 +340,6 @@ export class Draw {
|
|
|
|
|
|
|
|
|
|
|
|
public insertElementList(payload: IElement[]) {
|
|
|
|
public insertElementList(payload: IElement[]) {
|
|
|
|
if (!payload.length) return
|
|
|
|
if (!payload.length) return
|
|
|
|
const activeControl = this.control.getActiveControl()
|
|
|
|
|
|
|
|
if (activeControl) {
|
|
|
|
|
|
|
|
const element = activeControl.getElement()
|
|
|
|
|
|
|
|
if (element.controlComponent !== ControlComponent.POSTFIX) return
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
const isPartRangeInControlOutside = this.control.isPartRangeInControlOutside()
|
|
|
|
const isPartRangeInControlOutside = this.control.isPartRangeInControlOutside()
|
|
|
|
if (isPartRangeInControlOutside) return
|
|
|
|
if (isPartRangeInControlOutside) return
|
|
|
|
const { startIndex, endIndex } = this.range.getRange()
|
|
|
|
const { startIndex, endIndex } = this.range.getRange()
|
|
|
|
@ -353,27 +348,36 @@ export class Draw {
|
|
|
|
isHandleFirstElement: false,
|
|
|
|
isHandleFirstElement: false,
|
|
|
|
editorOptions: this.options
|
|
|
|
editorOptions: this.options
|
|
|
|
})
|
|
|
|
})
|
|
|
|
const elementList = this.getElementList()
|
|
|
|
let curIndex = -1
|
|
|
|
const isCollapsed = startIndex === endIndex
|
|
|
|
// 判断是否在控件内
|
|
|
|
const start = startIndex + 1
|
|
|
|
const activeControl = this.control.getActiveControl()
|
|
|
|
if (!isCollapsed) {
|
|
|
|
if (activeControl && !this.control.isRangInPostfix()) {
|
|
|
|
elementList.splice(start, endIndex - startIndex)
|
|
|
|
curIndex = activeControl.setValue(payload)
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
const positionContext = this.position.getPositionContext()
|
|
|
|
const elementList = this.getElementList()
|
|
|
|
for (let i = 0; i < payload.length; i++) {
|
|
|
|
const isCollapsed = startIndex === endIndex
|
|
|
|
const element = payload[i]
|
|
|
|
const start = startIndex + 1
|
|
|
|
if (positionContext.isTable) {
|
|
|
|
if (!isCollapsed) {
|
|
|
|
element.tdId = positionContext.tdId
|
|
|
|
elementList.splice(start, endIndex - startIndex)
|
|
|
|
element.trId = positionContext.trId
|
|
|
|
|
|
|
|
element.tableId = positionContext.tableId
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
elementList.splice(start + i, 0, element)
|
|
|
|
const positionContext = this.position.getPositionContext()
|
|
|
|
|
|
|
|
for (let i = 0; i < payload.length; i++) {
|
|
|
|
|
|
|
|
const element = payload[i]
|
|
|
|
|
|
|
|
if (positionContext.isTable) {
|
|
|
|
|
|
|
|
element.tdId = positionContext.tdId
|
|
|
|
|
|
|
|
element.trId = positionContext.trId
|
|
|
|
|
|
|
|
element.tableId = positionContext.tableId
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
elementList.splice(start + i, 0, element)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
curIndex = startIndex + payload.length
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (~curIndex) {
|
|
|
|
|
|
|
|
this.range.setRange(curIndex, curIndex)
|
|
|
|
|
|
|
|
this.render({
|
|
|
|
|
|
|
|
curIndex
|
|
|
|
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
const curIndex = startIndex + payload.length
|
|
|
|
|
|
|
|
this.range.setRange(curIndex, curIndex)
|
|
|
|
|
|
|
|
this.render({
|
|
|
|
|
|
|
|
curIndex
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public getOriginalElementList() {
|
|
|
|
public getOriginalElementList() {
|
|
|
|
|