Skip to content

Allow disabling togglable elements #1816

Closed

Description

@ClementEXWiki

Is your feature request related to a problem? Please describe.
Our current usage for BlockNote is to edit and render Markdown (GFM) documents. As GMT doesn't natively support togglable elements (and we don't support HTML), we'd like to remove the support for togglable elements.

For togglable list items, it's easy: we just pick them out of the schema. But for togglable headers, it's more complicated.

Describe the solution you'd like
Add an option (in the schema maybe? or in the editor's options?) to disable the ability to create togglable headings, etc.

Describe alternatives you've considered
N/A

Additional context
N/A

Bonus
[ ] I'm a sponsor and would appreciate if you could look into this sooner than later 💖

Activity

  1. YousefED commented on Jul 7, 2025

    @YousefED
    Collaborator

    @nperez0111 @matthewlipski I think we discussed this the other day. What's the recommended approach for this atm?

  2. nperez0111 commented on Jul 8, 2025

    @nperez0111
    Contributor

    The only way to create toggle headings by default is via the slash menu, so the recommended way to remove toggle heading support is to filter out the toggle heading from the slash menu similar to this example:

    getItems={async (query) =>
    filterSuggestionItems(
    getDefaultReactSlashMenuItems(editor).filter(
    (item) => item.title !== "Emoji",
    ),
    query,
    )
    }

  3. nperez0111 commented on Jul 8, 2025

    @nperez0111
    Contributor

    In the future, we will probably have configuration at the schema level for this, but at the moment we do not have an API which allows this sort of configuration.

  4. ClementEXWiki commented on Jul 8, 2025

    @ClementEXWiki
    Author

    The only way to create toggle headings by default is via the slash menu, so the recommended way to remove toggle heading support is to filter out the toggle heading from the slash menu similar to this example:

    BlockNote/examples/03-ui-components/13-custom-ui/App.tsx

    Lines 77 to 84 in 0ad2da6
    getItems={async (query) =>
    filterSuggestionItems(
    getDefaultReactSlashMenuItems(editor).filter(
    (item) => item.title !== "Emoji",
    ),
    query,
    )
    }

    This works but is really an ugly way of doing this IMO, more akin to a "hack" than anything else.
    We are filtering on the title of the elements instead of their behavior, so I'm not very fond of this approach.

    But sure, it works for now, I'll use it for the time being, but I think an editor option or a schema option would definitely be the best approach.

  5. nperez0111 commented on Jul 9, 2025

    @nperez0111
    Contributor

    Yep, not a great way to do it. We will fix this eventually

  6. MetaMmodern commented on Jul 23, 2025

    @MetaMmodern

    @nperez0111 continuing here: but slash menu is not the only place where you could access toggleable headings.

    Image

    Here they are in the Formatting Toolbar as well

    So you're saying for now only way to hide them is to customize both SlashMenu and FormattingToolbar individually?

  7. nperez0111 commented on Jul 23, 2025

    @nperez0111
    Contributor

    Yes, right now that'd be the only way to do it.

  8. ClementEXWiki commented on Feb 12, 2026

    @ClementEXWiki
    Author

    Hi, I was wondering if this issue should be re-opened? Having a dirty way to do it (which requires manually filtering elements and heavily customizing the toolbar) is not a good solution IMO, so it would be nice to have this issue open until the feature is ready in BlockNote (even if it's not a priority right now) :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions