Fix text truncation: use textTruncation field instead of textAutoResize

This commit is contained in:
Danila Poyarkov 2026-03-04 09:04:04 +03:00
parent 8d22415ceb
commit 68cfba3b6d

View file

@ -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],