Skip to content
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-playground] Bug Fix: Added blur event #6011

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

CARPEDIEM05
Copy link

Description

Current behaviour - > Font size was not changing even after changing the input size field.
Modified behaviour -> triggered the blur event, because of that font is changing as soon as we blur out of the input box.
Describe the changes in this pull request

Closes: #6000

Copy link

vercel bot commented May 2, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
lexical ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 4, 2024 4:27am
lexical-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 4, 2024 4:27am

@facebook-github-bot
Copy link
Contributor

Hi @CARPEDIEM05!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

@Shubhankerism
Copy link
Collaborator

Hi, I'm not sure if we want to update the font size on blur event. We want to update the font size only when the user presses the enter key or any of the +/- buttons. However, it would be nice to revert to current font size value in the input field, if the user removes focus from the font input entry without pressing enter. In other words, the font size input field, when not in focus, should always show the selection font size.

Added updated blur event which attain previous value if not committed by user
@CARPEDIEM05
Copy link
Author

CARPEDIEM05 commented May 2, 2024

Hi @Shubhankerism, can you review this? I have updated the code according to the prev value if it is not committed by the user.

@CARPEDIEM05
Copy link
Author

Hi @Shubhankerism, can you review the code?

Comment on lines 171 to 174
const inputValueNumber = Number(selectionFontSize);
const prevFontSize = inputValueNumber;
setInputValue(String(prevFontSize));
updateFontSizeInSelection(String(prevFontSize) + 'px', null);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
const inputValueNumber = Number(selectionFontSize);
const prevFontSize = inputValueNumber;
setInputValue(String(prevFontSize));
updateFontSizeInSelection(String(prevFontSize) + 'px', null);
if (inputValue !== selectionFontSize) {
setInputValue(selectionFontSize);
}

Copy link
Collaborator

Choose a reason for hiding this comment

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

We don't need to update the font size in selection, just update the input value.

Updated the font size on the blur event.
@CARPEDIEM05
Copy link
Author

Hi @Shubhankerism , I tested the changes and you are right. Thank you so much for the suggestions.

Copy link
Author

@CARPEDIEM05 CARPEDIEM05 left a comment

Choose a reason for hiding this comment

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

Issue - Because of no blur event, there was bug with the font size not getting change and even not getting reverse to its original value.
Solution - Added the blur event.

@Shubhankerism
Copy link
Collaborator

Can you sign the CLA?

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.

None yet

3 participants