Browse Source

fix: Modify the way to clear ellipsisContainer and removDDe the obsolete use of ReactDOM.render()

zhangyumei.0319 8 months ago
parent
commit
1ca2dfd4aa
1 changed files with 2 additions and 5 deletions
  1. 2 5
      packages/semi-ui/typography/util.tsx

+ 2 - 5
packages/semi-ui/typography/util.tsx

@@ -78,11 +78,8 @@ const getRenderText = (
     ellipsisContainer.style.textOverflow = 'clip';
     ellipsisContainer.style.webkitLineClamp = 'none';
 
-    // Render fake container
-    ReactDOM.render(
-        <></>,
-        ellipsisContainer
-    );
+    // Clear container content
+    ellipsisContainer.innerHTML = '';
 
     // Check if ellipsis in measure div is enough for content
     function inRange() {