Skip to content

feat: Input rule scoping #1799

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

feat: Input rule scoping #1799

wants to merge 1 commit into from

Conversation

matthewlipski
Copy link
Collaborator

@matthewlipski matthewlipski commented Jun 30, 2025

This PR adds an editor option which allows for scoping on input rules, i.e. commands which change the block type after a string is typed ("# " for headings, "- " for bullet lists, etc). The editor option, inputRules, can be set to "allBlocks", "paragraphs", or "none" (defaults to "allBlocks"). This makes it so that the input rules can be triggered in all blocks, paragraphs only, or never respectively.

I think until we have a proper input rule/keyboard shortcut API, this is the approach that makes most sense.

Closes #1729
Closes #1710
Closes #1789

Copy link

vercel bot commented Jun 30, 2025

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

Name Status Preview Updated (UTC)
blocknote ✅ Ready (Inspect) Visit Preview Jun 30, 2025 5:07pm
blocknote-website ✅ Ready (Inspect) Visit Preview Jun 30, 2025 5:07pm

Copy link

pkg-pr-new bot commented Jun 30, 2025

Open in StackBlitz

@blocknote/ariakit

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

@blocknote/code-block

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

@blocknote/core

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

@blocknote/mantine

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

@blocknote/react

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

@blocknote/server-util

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

@blocknote/shadcn

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

@blocknote/xl-ai

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/xl-ai@1799

@blocknote/xl-docx-exporter

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

@blocknote/xl-email-exporter

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

@blocknote/xl-multi-column

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

@blocknote/xl-odt-exporter

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

@blocknote/xl-pdf-exporter

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

commit: c713182

@nperez0111
Copy link
Contributor

I'm not sure about this...

It makes all input rules an all or nothing thing. I think what we should aim for is to mimic whatever notion does right now (which I suspect is similar behavior to inputRule: paragraph in this PR like this pr too: #1729).

The thing here is that as a user it is doing something that the user does not expect, in a heading, it should not change to a list item just because you typed 1. XYZ since that is a normal heading name.

So ideally, we'd minimize configuration, because I don't see why anyone would configure this. This is similar to the sidemenu configuration, a stop gap that does not really solve the problem, I'd like to avoid adding more of that into the project.

@matthewlipski
Copy link
Collaborator Author

Yeah that's kind of the weird thing, is that Notion's behaviour is the same as what we have now, i.e. hitting "- " at the start of a heading block does change it into a bullet list. I also thought it would have the same behaviour as inputRules: "paragraphs" in this PR, but seems like what people are requesting is different to what Notion does. That's why I decided to make it configurable.

I do agree though that it's a stopgap measure and that we ideally we would just let the consumer configure input rules and keyboard shortcuts for each block, but we don't currently have an API 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.

I can't add numbered headings Typing 1. or + and hitting space changes block type.
2 participants