Skip to content

Commit

Permalink
fix(comp:text): text blinks when content doesn't exceed one row (#1706)
Browse files Browse the repository at this point in the history
  • Loading branch information
sallerli1 committed Oct 7, 2023
1 parent 3ae8dd2 commit 5afea2f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/components/text/src/composables/useEllipsis.ts
Expand Up @@ -104,6 +104,7 @@ export function useEllipsis(

const walk = () => {
const measureHeight = measureRef.value?.offsetHeight ?? 0
const conentHeight = contentRef.value?.offsetHeight ?? 0

if (measureStatus.value === 'preparing') {
if (!rowMeasureRef.value) {
Expand All @@ -112,8 +113,7 @@ export function useEllipsis(

rowHeight = rowMeasureRef.value?.offsetHeight ?? 0
maxHeight = rows.value * rowHeight

if (measureHeight <= maxHeight) {
if (conentHeight <= maxHeight || measureHeight <= maxHeight) {
setIsEllipsis(false)
setLastRenderIndex(contentNodesLength.value)
currentWalk = undefined
Expand Down Expand Up @@ -172,6 +172,10 @@ export function useEllipsis(
immediate: true,
})
useResizeObserver(contentRef, () => {
if (measureStatus.value !== 'none') {
return
}

const width = contentRef.value?.offsetWidth ?? 0

if (width !== contentWidth.value) {
Expand Down

0 comments on commit 5afea2f

Please sign in to comment.