Skip to content

Conversation

clementprevot
Copy link

This typically can happen when you add display: flex to .bn-block-group with a gap.
You can then happen to hover the group itself instead of a block or outer block element

When this happens, the id that would be given to editor.getBlock would be null, making it fail (by the way, adding an optional chaining operator or checking for null/undefined here may be a good idea, let me know if you want me to make a PR for that).

This typically can happen when you add `display: flex` to `.bn-block-group` with a gap.
You can then happen to hover the group itself instead of a block or outer block element

When this happens, the id that would be given to `editor.getBlock` would be `null`, making it fail.
Copy link

vercel bot commented Jun 5, 2024

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

Name Status Preview Updated (UTC)
blocknote ✅ Ready (Inspect) Visit Preview Jun 5, 2024 10:03am

Copy link

vercel bot commented Jun 5, 2024

@clementprevot is attempting to deploy a commit to the TypeCell Team on Vercel.

A member of the Team first needs to authorize it.


this.hoveredBlock = block.node;

if (!this.hoveredBlock?.hasAttribute("data-id")) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

@matthewlipski can you review this, and also see if this check should be here or not? Could it also be that hoveredBlock shouldn't have been set in the first place if it doesn't have data-id?

@YousefED YousefED requested a review from matthewlipski June 5, 2024 12:18
@matthewlipski
Copy link
Collaborator

Thanks for your submission! Your solution does indeed fix this issue, though after looking through the code I figured there was some more fundamental issues with it that should also be fixed along with this bug. I created a new PR with those changes, see #814 for that.

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.

3 participants