diff --git a/src/editor/core/command/CommandAdapt.ts b/src/editor/core/command/CommandAdapt.ts index dae3260..4cdd86a 100644 --- a/src/editor/core/command/CommandAdapt.ts +++ b/src/editor/core/command/CommandAdapt.ts @@ -1355,9 +1355,15 @@ export class CommandAdapt { d++ } } - // 重新渲染 - const curIndex = startTd.value.length - 1 + // 设置上下文信息 + this.position.setPositionContext({ + ...positionContext, + trIndex: anchorTd.trIndex, + tdIndex: anchorTd.tdIndex + }) + const curIndex = anchorTd.value.length - 1 this.range.setRange(curIndex, curIndex) + // 重新渲染 this.draw.render() this.tableTool.render() } diff --git a/src/editor/core/draw/particle/table/TableParticle.ts b/src/editor/core/draw/particle/table/TableParticle.ts index 089d603..1350ad6 100644 --- a/src/editor/core/draw/particle/table/TableParticle.ts +++ b/src/editor/core/draw/particle/table/TableParticle.ts @@ -380,6 +380,8 @@ export class TableParticle { td.height = height td.rowIndex = t td.colIndex = colIndex + td.trIndex = t + td.tdIndex = d // 当前列x轴累加 preX += width // 一行中的最后td diff --git a/src/editor/interface/table/Td.ts b/src/editor/interface/table/Td.ts index 9270ab5..0535990 100644 --- a/src/editor/interface/table/Td.ts +++ b/src/editor/interface/table/Td.ts @@ -13,6 +13,8 @@ export interface ITd { colspan: number rowspan: number value: IElement[] + trIndex?: number + tdIndex?: number isLastRowTd?: boolean isLastColTd?: boolean isLastTd?: boolean