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

Fix toolbar button state not updated in some cases #2892

Merged
merged 1 commit into from
Feb 12, 2024

Conversation

alecgibson
Copy link
Contributor

This change fixes the following bug:

  1. Start with plain text "foo bar" in the editor
  2. Highlight "bar" (NB: it's important to select text that's not at
    the start)
  3. Hit Ctrl+B to apply bold formatting
  4. Notice that the bold button in the toolbar doesn't receive the
    ql-active class, when it should

Jan-02-2020 11-23-52

This appears to happen because the listener on SCROLL_OPTIMIZE gets an
incorrect range.

Instead of listening on optimize, we listen for all EDITOR_CHANGE
events, which do get the correct range.

This change fixes the following bug:

  1. Start with plain text "foo bar" in the editor
  2. Highlight "bar" (NB: it's important to select text that's not at
     the start)
  3. Hit Ctrl+B to apply bold formatting
  4. Notice that the bold button in the toolbar doesn't receive the
     `ql-active` class, when it should

This appears to happen because the listener on `SCROLL_OPTIMIZE` gets an
incorrect range.

Instead of listening on optimize, we listen for all `EDITOR_CHANGE`
events, which _do_ get the correct range.
@luin luin merged commit 9e7ff2a into slab:develop Feb 12, 2024
5 checks passed
@luin luin changed the title Update toolbar on format Fix toolbar button state not updated in some cases Feb 12, 2024
@alecgibson alecgibson deleted the toolbar-highlight branch February 12, 2024 08:26
luin pushed a commit that referenced this pull request Feb 13, 2024
Co-authored-by: Alec Gibson <aleckgibson@gmail.com>
luin pushed a commit that referenced this pull request Feb 13, 2024
Co-authored-by: Alec Gibson <aleckgibson@gmail.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