fix: paste list element boundary error #487
This commit is contained in:
@@ -581,6 +581,18 @@ export class Draw {
|
|||||||
}
|
}
|
||||||
this.spliceElementList(elementList, start, 0, ...payload)
|
this.spliceElementList(elementList, start, 0, ...payload)
|
||||||
curIndex = startIndex + payload.length
|
curIndex = startIndex + payload.length
|
||||||
|
// 列表前如有换行符则删除-因为列表内已存在
|
||||||
|
const preElement = elementList[start - 1]
|
||||||
|
if (
|
||||||
|
payload[0].listId &&
|
||||||
|
preElement &&
|
||||||
|
!preElement.listId &&
|
||||||
|
preElement?.value === ZERO &&
|
||||||
|
(!preElement.type || preElement.type === ElementType.TEXT)
|
||||||
|
) {
|
||||||
|
elementList.splice(startIndex, 1)
|
||||||
|
curIndex -= 1
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (~curIndex) {
|
if (~curIndex) {
|
||||||
this.range.setRange(curIndex, curIndex)
|
this.range.setRange(curIndex, curIndex)
|
||||||
|
|||||||
@@ -33,10 +33,17 @@ export function keydown(evt: KeyboardEvent, host: CanvasEvent) {
|
|||||||
curIndex = control.keydown(evt)
|
curIndex = control.keydown(evt)
|
||||||
} else {
|
} else {
|
||||||
// 判断是否允许删除
|
// 判断是否允许删除
|
||||||
if (isCollapsed && elementList[index].value === ZERO && index === 0) {
|
if (isCollapsed && index === 0) {
|
||||||
|
const firstElement = elementList[index]
|
||||||
|
if (firstElement.value === ZERO) {
|
||||||
|
// 取消首字符列表设置
|
||||||
|
if (firstElement.listId) {
|
||||||
|
draw.getListParticle().unsetList()
|
||||||
|
}
|
||||||
evt.preventDefault()
|
evt.preventDefault()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// 清空当前行对齐方式
|
// 清空当前行对齐方式
|
||||||
const startElement = elementList[startIndex]
|
const startElement = elementList[startIndex]
|
||||||
if (isCollapsed && startElement.rowFlex && startElement.value === ZERO) {
|
if (isCollapsed && startElement.rowFlex && startElement.value === ZERO) {
|
||||||
|
|||||||
Reference in New Issue
Block a user