diff --git a/src/editor/core/draw/Draw.ts b/src/editor/core/draw/Draw.ts index 1c44f89..494f439 100644 --- a/src/editor/core/draw/Draw.ts +++ b/src/editor/core/draw/Draw.ts @@ -1318,7 +1318,7 @@ export class Draw { const positionContext = this.position.getPositionContext() if (positionContext.isTable) { const { index, trIndex, tdIndex } = positionContext - const elementList = this.getElementList() + const elementList = this.getOriginalElementList() const tablePositionList = elementList[index!].trList?.[trIndex!].tdList[tdIndex!].positionList if (curIndex === undefined && tablePositionList) { curIndex = tablePositionList.length - 1 diff --git a/src/editor/core/event/handlers/click.ts b/src/editor/core/event/handlers/click.ts index a8dc877..bf7decd 100644 --- a/src/editor/core/event/handlers/click.ts +++ b/src/editor/core/event/handlers/click.ts @@ -11,8 +11,8 @@ function dblclick(host: CanvasEvent, evt: MouseEvent) { y: evt.offsetY }) if (!~positionContext.index && positionContext.zone) { - const zoneManager = draw.getZone() - zoneManager.setZone(positionContext.zone) + draw.getZone().setZone(positionContext.zone) + draw.getRange().clearRange() draw.render({ isSubmitHistory: false, isSetCursor: false, diff --git a/src/editor/core/position/Position.ts b/src/editor/core/position/Position.ts index 4534d02..b4b9f0b 100644 --- a/src/editor/core/position/Position.ts +++ b/src/editor/core/position/Position.ts @@ -35,16 +35,14 @@ export class Position { } public getPositionList(): IElementPosition[] { - const elementList = this.draw.getElementList() return this.positionContext.isTable - ? this.getTablePositionList(elementList) + ? this.getTablePositionList(this.draw.getOriginalElementList()) : this.getOriginalPositionList() } public getMainPositionList(): IElementPosition[] { - const elementList = this.draw.getMainElementList() return this.positionContext.isTable - ? this.getTablePositionList(elementList) + ? this.getTablePositionList(this.draw.getOriginalMainElementList()) : this.positionList } diff --git a/src/editor/core/range/RangeManager.ts b/src/editor/core/range/RangeManager.ts index 3808e29..15da647 100644 --- a/src/editor/core/range/RangeManager.ts +++ b/src/editor/core/range/RangeManager.ts @@ -34,6 +34,10 @@ export class RangeManager { return this.range } + public clearRange() { + this.setRange(-1, -1) + } + public getSelection(): IElement[] | null { const { startIndex, endIndex } = this.range if (startIndex === endIndex) return null