From 68cfba3b6d1992cab26a7dcd01ecf2d9f2184734 Mon Sep 17 00:00:00 2001 From: Danila Poyarkov Date: Wed, 4 Mar 2026 09:04:04 +0300 Subject: [PATCH] Fix text truncation: use textTruncation field instead of textAutoResize --- packages/core/src/renderer.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/packages/core/src/renderer.ts b/packages/core/src/renderer.ts index d6690fc5a..7cf4898c5 100644 --- a/packages/core/src/renderer.ts +++ b/packages/core/src/renderer.ts @@ -2014,8 +2014,20 @@ export class SkiaRenderer { const baseColor = color ?? ck.BLACK const baseFontSize = node.fontSize || DEFAULT_FONT_SIZE + const truncateOpts: { maxLines?: number; ellipsis?: string } = {} + if (node.textTruncation === 'ENDING') { + if (node.maxLines != null && node.maxLines > 0) { + truncateOpts.maxLines = node.maxLines + } else if (node.height > 0) { + const lineH = node.lineHeight || baseFontSize * 1.2 + truncateOpts.maxLines = Math.max(1, Math.floor(node.height / lineH)) + } + truncateOpts.ellipsis = '…' + } + const paraStyle = new ck.ParagraphStyle({ textAlign: this.getTextAlign(node.textAlignHorizontal), + ...truncateOpts, textStyle: { color: baseColor, fontFamilies: [node.fontFamily || DEFAULT_FONT_FAMILY],