tiptap: Hash character with the suggestion utility conflicts with heading Markdown shortcut
What’s the bug you are facing?
When using the # as the char in the Suggestion utility, this conflicts with the heading Markdown shortcut IF it’s the first character in an empty paragraph. Instead of adding the selected suggestion, the paragraph is converted to a heading instead.
How can we reproduce the bug on our side?
- Take the CodeSandbox as an example
- Type
#into the editor as the first character in an empty paragraph - Press <kbd>Enter</kbd> to select an item from the dropdown
- Observe that the empty paragraph is converted into a heading
Can you provide a CodeSandbox?
What did you expect to happen?
The selected suggestion from the dropdown should’ve been added to the editor.
Anything to add? (optional)
A few observations:
- I understand that I can disable the heading input rule to work around this issue, but we’re looking for a way to have both things working.
- After some research I’ve noticed that all input rules take priority over anything else (i.e. the input rules
handleKeyDownwill take precedence over other extensions/pluginshandleKeyDownevent handlers, that’s why we have the behavior here described. - Possible solution: We need a way to sort ProseMirror plugins based on a
priorityproperty (similar to what we have for extensions) so that we can have certain plugins being handled before the input rules plugin.
Did you update your dependencies?
- Yes, I’ve updated my dependencies to use the latest version of all packages.
Are you sponsoring us?
- Yes, I’m a sponsor. 💖 (on behalf of Doist)
About this issue
- Original URL
- State: open
- Created 2 years ago
- Reactions: 9
- Comments: 18 (9 by maintainers)
I don’t think it does because the problem here lies in the ProseMirror plugins priority, and not the Tiptap extensions priority (which are 2 different things). As I’ve suggested in the OP, I think we need a way to override the priority for ProseMirror plugins, akin to the Extensions
priorityfield.