Skip to content

Commit 89d107f

Browse files
author
kongshan
committed
feat: replace English comments
1 parent 4b864ff commit 89d107f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/components/ellipsisText/index.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,22 +40,24 @@ export default class EllipsisText extends PureComponent<Props, State> {
4040
};
4141

4242
getStyle = (dom: NewHTMLElement, attr: string) => {
43-
// 兼容IE8
43+
// Compatible width IE8
4444
const stylePadding =
4545
window?.getComputedStyle(dom)[attr] || dom.currentStyle[attr];
4646

4747
return parseInt(stylePadding.replace('px', ''));
4848
};
4949

50-
// 最近块级父元素-除省略文本元素外其余元素的宽
50+
// The nearest block parent element
5151
getMaxWidth = (ele: HTMLElement) => {
5252
if (!ele) return;
5353
const { scrollWidth, offsetWidth, parentElement } = ele;
54+
// If inline element, find the parent element
5455
if (scrollWidth === 0) {
5556
return this.getMaxWidth(parentElement);
5657
}
5758
const ellipsisNode = this.ellipsisRef;
5859
ellipsisNode.style.display = "none";
60+
// Get the width of elements other than omitted text
5961
const rangeWidth = this.getRangeWidth(ele);
6062
const ellipsisWidth =
6163
offsetWidth -

0 commit comments

Comments
 (0)