Repository navigation
Format Library: Add formatting options for word break and soft hyphen - #71521
BugReportOnWeb wants to merge 2 commits into
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Unlinked AccountsThe following contributors have not linked their GitHub and WordPress.org accounts: @senicar. Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases. If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
Thank you for contributing. I know this is an older PR, but I'm wondering if there's a way to resurrect it, as it's relatively small and simple. I'm not personally convinced we should add both the soft hyphen and the wbr glyphs, it seems like the latter offers the more easy to understand user experience. But as a relatively simple PR it might be a nice addition. CC: @WordPress/gutenberg-design for a fresh look. One longer term perspective is to also address #31401. The big challenge we have is that we risk making the inline format library grow very long. Today it looks like this:
If we add three new menu items, the menu can grow quite long. However one thing we could possibly do, is refactor this menu to use the new Menu component. What this would offer is the ability to create submenus. We could add to the inline formatting library a submenu called "Special character", which would contain both wbr, soft hyphen, nonbreakingspace, and so on. There's a question of the black border of block toolbar submenus to address as part of that, but that's a challenge worth considering regardless. |
|
Thank you for the work here @BugReportOnWeb ! +1 from my side to get this merged |
I think this is a great idea! |
|
Hey 👋 I wanted to give you a heads-up since this pull request adds new files containing JSX. #80123 enables an ESLint rule that requires that files containing JSX must use the What you'll need to do: You'll need to rename any new files containing JSX to use the This comment is automated, based on pull requests with recent activity that contain affected |

What?
Closes #55565
This PR introduces two new inline formatting options to the editor:
<wbr>): allows manual control of where a long word may break without inserting visible characters.­): adds a discretionary hyphen that only appears at line breaks.Why?
In some languages, long words often break incorrectly on smaller screens. Adding options for
<wbr>and­gives authors precise control over word breaking, improving readability across devices and languages.How?
line-breakformat module format library.core/line-break-wbr: inserts<wbr>at the caret positioncore/soft-hyphen: inserts a soft hyphen (\u00AD) at the caret position.Testing Instructions
<wbr>or­should be inserted at the cursor position.<wbr>: line may break without hyphen.­: line may break with hyphen shown.Screenshots or screencast
Screen.Recording.2025-09-05.at.6.50.43.PM.mov