File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
src/components/ellipsisText Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -40,22 +40,24 @@ export default class EllipsisText extends PureComponent<Props, State> {
40
40
} ;
41
41
42
42
getStyle = ( dom : NewHTMLElement , attr : string ) => {
43
- // 兼容IE8
43
+ // Compatible width IE8
44
44
const stylePadding =
45
45
window ?. getComputedStyle ( dom ) [ attr ] || dom . currentStyle [ attr ] ;
46
46
47
47
return parseInt ( stylePadding . replace ( 'px' , '' ) ) ;
48
48
} ;
49
49
50
- // 最近块级父元素-除省略文本元素外其余元素的宽
50
+ // The nearest block parent element
51
51
getMaxWidth = ( ele : HTMLElement ) => {
52
52
if ( ! ele ) return ;
53
53
const { scrollWidth, offsetWidth, parentElement } = ele ;
54
+ // If inline element, find the parent element
54
55
if ( scrollWidth === 0 ) {
55
56
return this . getMaxWidth ( parentElement ) ;
56
57
}
57
58
const ellipsisNode = this . ellipsisRef ;
58
59
ellipsisNode . style . display = "none" ;
60
+ // Get the width of elements other than omitted text
59
61
const rangeWidth = this . getRangeWidth ( ele ) ;
60
62
const ellipsisWidth =
61
63
offsetWidth -
You can’t perform that action at this time.
0 commit comments