Skip to content

fix: Formatting toolbar appearance on fade out#642

Closed
matthewlipski wants to merge 1 commit into
mainfrom
formatting-toolbar-fade-fix
Closed

fix: Formatting toolbar appearance on fade out#642
matthewlipski wants to merge 1 commit into
mainfrom
formatting-toolbar-fade-fix

Conversation

@matthewlipski
Copy link
Copy Markdown
Collaborator

Because formatting toolbar buttons manage their own state, they check whether they should be shown based on the block that the text cursor is in. This can be a problem if the user clicks a block of a different type to close the toolbar, as it can cause the toolbar state to change as it's fading out, which looks bad. This PR fixes that by making the plugin figure out which block(s) are selected instead, and including them in the plugin state for the toolbar buttons.

The difference between this approach and using useSelectedBlocks is that the plugin will NOT update the selected blocks if state.show is false, so the selected blocks are only updated when the formatting toolbar itself is shown/updated.

This is similar to how & why we pass the hovered block in the side menu/drag handle menu, so I think this pattern makes sense.

@vercel
Copy link
Copy Markdown

vercel Bot commented Mar 13, 2024

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

Name Status Preview Updated (UTC)
blocknote ✅ Ready (Inspect) Visit Preview Mar 13, 2024 3:28pm
blocknote-website ✅ Ready (Inspect) Visit Preview Mar 13, 2024 3:28pm

@matthewlipski
Copy link
Copy Markdown
Collaborator Author

Fixed with #645

@nperez0111 nperez0111 deleted the formatting-toolbar-fade-fix branch October 21, 2025 07:35
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.

1 participant