Skip to content

Commit

Permalink
fix(Ellipsis): walkingIndexes初始化覆盖计算结果,导致文本省略字数不符合预期 (ant-design#6792)
Browse files Browse the repository at this point in the history
  • Loading branch information
huang_cq committed Dec 13, 2024
1 parent 6f0a640 commit 10cceed
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/components/ellipsis/useMeasure.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,6 @@ export default function useMeasure(

const startMeasure = useEvent(() => {
setStatus(MEASURE_STATUS.PREPARE)
setWalkingIndexes([
0,
direction === 'middle'
? Math.ceil(contentChars.length / 2)
: contentChars.length,
])
})

// Initialize
Expand All @@ -72,6 +66,12 @@ export default function useMeasure(
setStatus(MEASURE_STATUS.STABLE_NO_ELLIPSIS)
} else {
setMaxHeight(rowMeasureHeight)
setWalkingIndexes([
0,
direction === 'middle'
? Math.ceil(contentChars.length / 2)
: contentChars.length,
])
setStatus(MEASURE_STATUS.MEASURE_WALKING)
}
}
Expand Down

0 comments on commit 10cceed

Please sign in to comment.