diff --git a/src/editor/core/draw/Draw.ts b/src/editor/core/draw/Draw.ts index d68c997..44cb227 100644 --- a/src/editor/core/draw/Draw.ts +++ b/src/editor/core/draw/Draw.ts @@ -207,12 +207,6 @@ export class Draw { } } positionList.push(positionItem) - this.ctx.fillText(element.value, x, y + curRow.ascent) - // 选区绘制 - const { startIndex, endIndex } = this.range.getRange() - if (startIndex < index && index <= endIndex) { - this.range.drawRange(x, y, metrics.width, curRow.height) - } // 下划线绘制 if (element.underline) { this.underline.render(x, y + curRow.height, metrics.width) @@ -225,6 +219,13 @@ export class Draw { if (element.highlight) { this.highlight.render(element.highlight, x, y, metrics.width, curRow.height) } + // 文本 + this.ctx.fillText(element.value, x, y + curRow.ascent) + // 选区绘制 + const { startIndex, endIndex } = this.range.getRange() + if (startIndex < index && index <= endIndex) { + this.range.drawRange(x, y, metrics.width, curRow.height) + } index++ x += metrics.width this.ctx.restore()