fix: merge table cell error #241

pr675
Hufe921 3 years ago
parent 7eb7e4ba52
commit 1f552a05d5

@ -215,13 +215,23 @@ export class TableParticle {
// 小于 // 小于
if (pTdX < x) continue if (pTdX < x) continue
if (pTdX > x) break if (pTdX > x) break
if (pTd.x === x && pTdY + pTdHeight > y) { if (pTdX === x && pTdY + pTdHeight > y) {
// 中间存在断行则移到断行后td位置
const nextPTd = pTr.tdList[pD + 1]
if (
nextPTd &&
pTd.colIndex! + pTd.colspan !== nextPTd.colIndex
) {
x = nextPTd.x!
offsetXIndex = nextPTd.colIndex!
} else {
x += pTdWidth x += pTdWidth
offsetXIndex += pTd.colspan offsetXIndex += pTd.colspan
} }
} }
} }
} }
}
// 计算格列数 // 计算格列数
let colIndex = 0 let colIndex = 0
const preTd = tr.tdList[d - 1] const preTd = tr.tdList[d - 1]
@ -301,6 +311,7 @@ export class TableParticle {
let endTd = trList[endTrIndex!].tdList[endTdIndex!] let endTd = trList[endTrIndex!].tdList[endTdIndex!]
// 交换起始位置 // 交换起始位置
if (startTd.x! > endTd.x! || startTd.y! > endTd.y!) { if (startTd.x! > endTd.x! || startTd.y! > endTd.y!) {
// prettier-ignore
[startTd, endTd] = [endTd, startTd] [startTd, endTd] = [endTd, startTd]
} }
const startColIndex = startTd.colIndex! const startColIndex = startTd.colIndex!

Loading…
Cancel
Save