Skip to content

docs: Update custom drag handle menu example #1628

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

Merged
merged 1 commit into from
Apr 23, 2025

Conversation

matthewlipski
Copy link
Collaborator

The example for customizing drag handle menu items creates a new component for the custom drag handle menu inline in the dragHandleMenu prop in the SideMenu component. Because the component is basically recreated on each re-render, the drag handle menu itself gets unnecessarily re-rendered a lot, and this can lead to some issues. Namely the colors dropdown gets hidden while scrolling in the Mantine UI, while the drag handle menu doesn't open at all in the ShadCN UI.

This PR updates the example so that the drag handle component is now defined externally instead of inline, which fixes the re-rendering issues. Tbh I would consider refactoring all of the examples in this way as this is good practice for React, but there's a small trade-off in simplicity that we would be making. However, other UI elements don't have noticeable rendering issues because of this, unlike the drag handle menu.

Closes #1602

Copy link

vercel bot commented Apr 22, 2025

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

Name Status Preview Updated (UTC)
blocknote ✅ Ready (Inspect) Visit Preview Apr 22, 2025 2:42pm
blocknote-website ✅ Ready (Inspect) Visit Preview Apr 22, 2025 2:42pm

Copy link

pkg-pr-new bot commented Apr 22, 2025

Open in StackBlitz

@blocknote/ariakit

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/ariakit@1628

@blocknote/code-block

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/code-block@1628

@blocknote/core

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/core@1628

@blocknote/mantine

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/mantine@1628

@blocknote/server-util

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/server-util@1628

@blocknote/react

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/react@1628

@blocknote/shadcn

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/shadcn@1628

@blocknote/xl-docx-exporter

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/xl-docx-exporter@1628

@blocknote/xl-multi-column

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/xl-multi-column@1628

@blocknote/xl-odt-exporter

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/xl-odt-exporter@1628

@blocknote/xl-pdf-exporter

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/xl-pdf-exporter@1628

commit: 818e36f

@nperez0111 nperez0111 merged commit 0fb6323 into main Apr 23, 2025
8 checks passed
@nperez0111 nperez0111 deleted the drag-handle-menu-example-update branch April 23, 2025 13:47
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.

Issue with scrolling behaviour when using custom SideMenu
2 participants