-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[lexical][Breaking Change][lexical-rich-text][lexical-playground] Feature: Support capitalization format #6897
[lexical][Breaking Change][lexical-rich-text][lexical-playground] Feature: Support capitalization format #6897
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
size-limit report 📦
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the feedback, that's a good point. I had implemented Title Case at first but then I realized there is an edge case that needs to be addressed. Unfortunately, text-transform: capitalize only capitalizes the first letter of each word, leaving the rest of the characters unchanged (for example: hELLO wORLD ends up being HELLO WORLD when it should have been Hello World). The only workaround I could find was converting the selection text to lowercase first, then the text-transform CSS property would work as expected. If this is acceptable, I'm happy to add it. What do you think? Reference to the workaround I mentioned: https://stackoverflow.com/a/13793667/14920149 |
…bedre7/lexical into feature/support-capitalization
…edre7/lexical into feature/support-capitalization
Hi @etrepum, it's now ready for review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! The only thing I noticed was a missing 'capitalize' in the flow type, but I committed a fix for that. Will merge once I see what the test run looks like just to be sure.
Description
This PR aims to add capitalization formats to text formatting options. Most text editors support capitalization formats. Currently, there is no way to change the capitalization of a written text without rewriting it entirely. The new capitalization formats added are lowercase, uppercase, and capitalize.
The behavior of capitalization format in other editors such as Google Docs, is as follows:
Test plan
Unit tests and e2e tests have been added
Before
There was no option to change the capitalization of existing text; users had to rewrite the entire text.
After
A selection's capitalization can be changed, allowing users to easily switch between lowercase and uppercase formats without needing to rewrite the text.
support-capitalization.mp4
Acknowledgement