-
-
Notifications
You must be signed in to change notification settings - Fork 570
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
base: main
Are you sure you want to change the base?
feat: Input rule scoping #1799
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@blocknote/ariakit
@blocknote/code-block
@blocknote/core
@blocknote/mantine
@blocknote/react
@blocknote/server-util
@blocknote/shadcn
@blocknote/xl-ai
@blocknote/xl-docx-exporter
@blocknote/xl-email-exporter
@blocknote/xl-multi-column
@blocknote/xl-odt-exporter
@blocknote/xl-pdf-exporter
commit: |
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 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. |
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 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. |
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