diff --git a/src/editor/core/draw/Draw.ts b/src/editor/core/draw/Draw.ts index 17f68f2..3e0022d 100644 --- a/src/editor/core/draw/Draw.ts +++ b/src/editor/core/draw/Draw.ts @@ -711,9 +711,13 @@ export class Draw { metrics.boundingBoxDescent = 0 metrics.boundingBoxAscent = metrics.height } else if (element.type === ElementType.BLOCK) { - metrics.width = element.width - ? element.width * scale - : this.getInnerWidth() + const innerWidth = this.getInnerWidth() + if (!element.width) { + metrics.width = innerWidth + } else { + const elementWidth = element.width * scale + metrics.width = elementWidth > innerWidth ? innerWidth : elementWidth + } metrics.height = element.height! * scale metrics.boundingBoxDescent = metrics.height metrics.boundingBoxAscent = 0 @@ -750,6 +754,7 @@ export class Draw { if ( preElement?.type === ElementType.TABLE || preElement?.type === ElementType.BLOCK + || element.type === ElementType.BLOCK || preElement?.imgDisplay === ImageDisplay.INLINE || element.imgDisplay === ImageDisplay.INLINE || curRow.width + metrics.width > innerWidth