Skip to content

feat: customize sidemenu #143

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 22 commits into from
Apr 19, 2023
Merged

feat: customize sidemenu #143

merged 22 commits into from
Apr 19, 2023

Conversation

YousefED
Copy link
Collaborator

@YousefED YousefED commented Mar 17, 2023

For customizing the BlockSideMenu, I think we can follow a similar approach as described in #142. We can make the default menu contents customizable allowing users to pass custom content for <Menu.Dropdown className={classes.root}>. This would make the entire dropdown menu customizable, while keeping it very simple.

Note that in this design, if users would want to customize more (i.e.: add a button besides the draghandle / plus button), they'd still need to provide a custom factory.

As a first start I simplified the Color Menu. @matthewlipski I know you were having some issues with this earlier, could you check if this approach doesn't have any of the bugs you encountered earlier?

  • check color menu refactor
  • Provide a custom Menu.Item wrapper (e.g.: BlockNoteMenuItem) that automatically callssetDragHandleMenuOpened(false); props.unfreezeMenu(); in onClick, so users don't need to do this manually
  • extract dropdown contents and allow users to easily customize this
  • docs + demo

# Conflicts:
#	packages/react/src/BlockSideMenu/components/BlockSideMenu.tsx
#	packages/react/src/BlockSideMenu/components/ColorPickerMenu.tsx
@vercel
Copy link

vercel bot commented Apr 3, 2023

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

Name Status Preview Comments Updated (UTC)
blocknote-website ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 19, 2023 1:36pm

@YousefED YousefED changed the base branch from main to custom-formattingtoolbar April 3, 2023 18:26
Copy link
Collaborator Author

@YousefED YousefED left a comment

Choose a reason for hiding this comment

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

some small comments

@YousefED YousefED merged commit 40b3cb0 into custom-formattingtoolbar Apr 19, 2023
YousefED added a commit that referenced this pull request Apr 19, 2023
* simplify formattingtoolbar

* Fixed React component types and added customizable formatting toolbar factory

* Finished formatting toolbar customization with old props

* Changed formatting toolbar props to use BlockNoteEditor

* Fixed text alignment with basic selection object

* Fixed block nesting tests

* Removed multiple block shorthand for updateBlock

* Added comments

* Removed redundant useCallback hooks

* Split `getActiveLink` to get text & url separately

* Removed unnecessary functions and `useCallback` hooks

* removed unnecessary `focus` calls

* Small fix

* Inline code style fix

* Added docs

* Small update

* Made selection undefined if nothing is selected

* Added selection docs

* Added styling docs

* Added nesting & un-nesting docs

* Small fix

* Added selection demo

* Minor fixes

* fix: hyperlink creation menu losing focus on click (#168)

* Doc changes & cleanup

* feat: customizable sidemenu (#143)

* simplify colorpicker

* Added basic mouse cursor position

* Added drag handle menu customization API

* Copied changes from PR and minor improvements

* Small changes

* Added `DragHandleMenuItem` component

* Fixed side menu unnecessary updates

* Removed unnecessary state

* Cleaned up code

* Changed how the side menu gets the hovered block

* Added side menu image

* Added docs

* Fixed comments in demo

* Made all menus/toolbars scroll with page

* Revert "Made all menus/toolbars scroll with page"

This reverts commit ee61bd0.

* Removed `editor` from dynamic props

* Documentation changes

* Small cleanup

* Vanilla example fix

---------

Co-authored-by: Matthew Lipski <matthewlipski@gmail.com>
Co-authored-by: Matthew Lipski <50169049+matthewlipski@users.noreply.github.com>

---------

Co-authored-by: Matthew Lipski <matthewlipski@gmail.com>
Co-authored-by: Matthew Lipski <50169049+matthewlipski@users.noreply.github.com>
fogle pushed a commit to fogle/BlockNote that referenced this pull request May 20, 2023
* simplify formattingtoolbar

* Fixed React component types and added customizable formatting toolbar factory

* Finished formatting toolbar customization with old props

* Changed formatting toolbar props to use BlockNoteEditor

* Fixed text alignment with basic selection object

* Fixed block nesting tests

* Removed multiple block shorthand for updateBlock

* Added comments

* Removed redundant useCallback hooks

* Split `getActiveLink` to get text & url separately

* Removed unnecessary functions and `useCallback` hooks

* removed unnecessary `focus` calls

* Small fix

* Inline code style fix

* Added docs

* Small update

* Made selection undefined if nothing is selected

* Added selection docs

* Added styling docs

* Added nesting & un-nesting docs

* Small fix

* Added selection demo

* Minor fixes

* fix: hyperlink creation menu losing focus on click (TypeCellOS#168)

* Doc changes & cleanup

* feat: customizable sidemenu (TypeCellOS#143)

* simplify colorpicker

* Added basic mouse cursor position

* Added drag handle menu customization API

* Copied changes from PR and minor improvements

* Small changes

* Added `DragHandleMenuItem` component

* Fixed side menu unnecessary updates

* Removed unnecessary state

* Cleaned up code

* Changed how the side menu gets the hovered block

* Added side menu image

* Added docs

* Fixed comments in demo

* Made all menus/toolbars scroll with page

* Revert "Made all menus/toolbars scroll with page"

This reverts commit ee61bd0.

* Removed `editor` from dynamic props

* Documentation changes

* Small cleanup

* Vanilla example fix

---------

Co-authored-by: Matthew Lipski <matthewlipski@gmail.com>
Co-authored-by: Matthew Lipski <50169049+matthewlipski@users.noreply.github.com>

---------

Co-authored-by: Matthew Lipski <matthewlipski@gmail.com>
Co-authored-by: Matthew Lipski <50169049+matthewlipski@users.noreply.github.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