fix: merge table cell error #241
This commit is contained in:
@@ -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!
|
||||||
|
|||||||
Reference in New Issue
Block a user