Skip to content

Conversation

@RylanBot
Copy link
Collaborator

@RylanBot RylanBot commented Dec 3, 2025

🤔 这个 PR 的性质是?

  • 日常 bug 修复
  • 新特性提交
  • 文档改进
  • 演示代码改进
  • 组件样式/交互改进
  • CI/CD 改进
  • 重构
  • 代码风格优化
  • 测试用例
  • 分支合并
  • 其他

🔗 相关 Issue

💡 需求背景和解决方案

https://tdesign.tencent.com/react/components/typography#可省略
image

📝 更新日志

  • fix(Typography): 修复开启 ellipsis 时,将一个完整英文单词切割放在两行的问题

  • 本条 PR 不需要纳入 Changelog

☑️ 请求合并前的自查清单

⚠️ 请自检并全部勾选全部选项⚠️

  • 文档已补充或无须补充
  • 代码演示已提供或无须提供
  • TypeScript 定义已补充或无须补充
  • Changelog 已提供或无须提供

@pkg-pr-new
Copy link

pkg-pr-new bot commented Dec 3, 2025

commit: f21c9b5

@github-actions
Copy link
Contributor

github-actions bot commented Dec 3, 2025

完成

@RylanBot RylanBot added WIP work in porgess and removed WIP work in porgess labels Dec 3, 2025
@HaixingOoO HaixingOoO requested review from Copilot and removed request for HaixingOoO, NWYLZW, ZWkang, carolin913, honkinglin and uyarn December 3, 2025 07:52
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a bug in the Typography component's ellipsis feature where English words were unexpectedly split across two lines when truncated. The fix introduces intelligent word boundary detection to break text at appropriate points (spaces, hyphens, punctuation) rather than mid-word.

Key Changes:

  • Added breakAtWordBoundary() method to detect and break at word boundaries
  • Applied word boundary logic to both last-line truncation and multi-line truncation scenarios
  • Minor formatting improvements to existing CHANGELOG entries

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
packages/components/typography/ellipsis/Truncate.tsx Adds breakAtWordBoundary() method and integrates it into the text truncation algorithm to prevent words from being split across lines
packages/tdesign-react/CHANGELOG.md Formatting improvements to existing entries (spacing around backticks), but missing a new entry for this PR

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants