-
Notifications
You must be signed in to change notification settings - Fork 179
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
Text Style: Reset font weight to regular on font family change #5360
Conversation
Size Change: +560 B (0%) Total Size: 1.5 MB
ℹ️ View Unchanged
|
4d222e5
to
88c97c7
Compare
Codecov Report
@@ Coverage Diff @@
## main #5360 +/- ##
==========================================
- Coverage 84.48% 84.47% -0.02%
==========================================
Files 1002 1003 +1
Lines 17647 17685 +38
==========================================
+ Hits 14909 14939 +30
- Misses 2738 2746 +8
Flags with carried forward coverage won't be shown. Click here to find out more.
|
…ly change"" This reverts commit c154176.
9ba7194
to
b89ff00
Compare
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.
This makes sense! Well done.
I think added a karma test for this edge case would be useful. It works great!
pushUpdate(({ content }) => { | ||
return { content: updater(content, ...args) }; | ||
}, true), |
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.
nit: this doesn't need the brackets, can just keep it how it was I think?
); | ||
|
||
// when selected elements update, run any queued pushes | ||
useEffect(() => { |
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.
👏 👏 👏
OPE, looks like those tests were moved to a different file while I was working on this. Brought them back! |
Summary
Bring back fix for #1899 and fix lingering bug. The original fix (#4900) implemented an almost complete fix, but left one bug which reverted any content changes in the currently editing text element when the font family was changed.
This PR re-applies the original fix and resolves the bug with content getting reverted when family changes.
Original fix PR: #4900
Revert PR: #5045
Relevant Technical Choices
This was a tricky one because the editor needs to get destroyed so that we can (1) set the font weight to the whole element and (2) make sure any content changes are saved first.
There's no way to have the appropriate content to clean up until after the editor closes, so this PR introduces a "queued push" concept that waits for
selectedElements
to update before resetting the font weight on the element.To-do
User-facing changes
Testing Instructions
Fixes #1899