fix: delete table col boundary error #688

main
Hufe921 2 years ago
parent eb3ea5ed55
commit 3f0a49f56b

@ -1179,37 +1179,23 @@ export class CommandAdapt {
this.deleteTable() this.deleteTable()
return return
} }
// 跨列处理 // 缩小colspan或删除与当前列重叠的单元格
for (let t = 0; t < curTrList.length; t++) { for (let t = 0; t < curTrList.length; t++) {
const tr = curTrList[t] const tr = curTrList[t]
for (let d = 0; d < tr.tdList.length; d++) { for (let d = 0; d < tr.tdList.length; d++) {
const td = tr.tdList[d] const td = tr.tdList[d]
if (td.colspan > 1) { if (
const tdColIndex = td.colIndex! td.colIndex! <= curColIndex &&
// 交叉减去一列 td.colIndex! + td.colspan > curColIndex
if ( ) {
tdColIndex <= curColIndex && if (td.colspan > 1) {
tdColIndex + td.colspan - 1 >= curColIndex td.colspan--
) { } else {
td.colspan -= 1 tr.tdList.splice(d, 1)
} }
} }
} }
} }
// 删除当前列
for (let t = 0; t < curTrList.length; t++) {
const tr = curTrList[t]
let start = -1
for (let d = 0; d < tr.tdList.length; d++) {
const td = tr.tdList[d]
if (td.colIndex === curColIndex) {
start = d
}
}
if (~start) {
tr.tdList.splice(start, 1)
}
}
element.colgroup?.splice(curColIndex, 1) element.colgroup?.splice(curColIndex, 1)
// 重新设置上下文 // 重新设置上下文
this.position.setPositionContext({ this.position.setPositionContext({

Loading…
Cancel
Save