Skip to content

Customizing the default formatting toolbar #1640

Closed
@ClementEXWiki

Description

@ClementEXWiki

Is your feature request related to a problem? Please describe.
I'd like to be able to remove some buttons from the default formatting toolbar, and also extend it.

For instance, here:

Image

I'd like to remove the link button (as it doesn't make sense in the editor I'm currently working on), and also add some new buttons at the end of the toolbar. Currently, adding new buttons make them float on the right side as they're not part of the same <div>

Describe the solution you'd like

  • Adding a prop to toggle every single button in FormattingToolbar
  • Adding a new prop in FormattingToolbar to add new buttons

Example of the object shape:

// New options
{
  enabledButtons?: { createLink?: boolean, defaultStyling?: boolean, alignment?: boolean, /* etc. */ }
  additionalButtons: Array<{
    icon: string,
    title: string,
    onClick: (editor: ...) => void,
  }>
}

Describe alternatives you've considered
I currently manually hide buttons in the toolbar using a very ugly hack, which is obviously not viable:

:deep(
  [data-floating-ui-focusable]
    > .bn-toolbar.bn-formatting-toolbar:first-child
    > button:last-child
) {
  display: none;
}

Additional context
N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions