Skip to content
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

[Bug]: Blockquote toggle shortcut not working #4005

Open
1 of 2 tasks
yan-yanishevsky opened this issue May 2, 2023 · 2 comments
Open
1 of 2 tasks

[Bug]: Blockquote toggle shortcut not working #4005

yan-yanishevsky opened this issue May 2, 2023 · 2 comments
Labels
Category: Open Source The issue or pull reuqest is related to the open source packages of Tiptap. Triage: Open A new issue or pullrequest that requires triage (added by default) Type: Bug The issue or pullrequest is related to a bug

Comments

@yan-yanishevsky
Copy link

Which packages did you experience the bug in?

extension-blockquote

What Tiptap version are you using?

2.0.0-beta.220

What’s the bug you are facing?

Mod-Shift-b doesn't toggle the Blockquote, it toggles Bold mark instead.
Tried on https://tiptap.dev/examples/default example

But It works if I disable Bold extension or if I extend Blockquote extension like this

const CustomBlockquote = Blockquote.extend({
  addKeyboardShortcuts() {
    return {
      'Mod-Shift-B': () => this.editor.commands.toggleBlockquote(),
    }
  },
})

What browser are you using?

Chrome

Code example

No response

What did you expect to happen?

Blockquote keyboard shortcut should work

Anything to add? (optional)

No response

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. 💖
@yan-yanishevsky yan-yanishevsky added Category: Open Source The issue or pull reuqest is related to the open source packages of Tiptap. Triage: Open A new issue or pullrequest that requires triage (added by default) Type: Bug The issue or pullrequest is related to a bug labels May 2, 2023
@ashu12chi
Copy link

The order of execution of keyboard shortcuts depends on the priority.
Since currently pressing Ctrl+Shift+B will fall back to Ctrl+B if Ctrl+Shift+B has lower priority or can't be executed. (Ref: #4006)

The default priority of all extensions is 100. (Ref: https://tiptap.dev/guide/custom-extensions/#priority)
To make this shortcut work, you can increase the priority of the blockquote extension to 101.

const CustomBlockquote = Blockquote.extend({
  priority: 101,
  addKeyboardShortcuts() {
    return {
      'Mod-Shift-B': () => this.editor.commands.toggleBlockquote(),
    }
  },
})

@yan-yanishevsky
Copy link
Author

yan-yanishevsky commented May 3, 2023

Hmm, I didn't know this also affects shortcuts.
So I guess the problem is in StarterKit extension, where Blockquote goes before Bold extension (as I know the order in extensions array also affects the order of their execution). Not sure if it is intentional.
Changing priority is also a solution, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category: Open Source The issue or pull reuqest is related to the open source packages of Tiptap. Triage: Open A new issue or pullrequest that requires triage (added by default) Type: Bug The issue or pullrequest is related to a bug
Projects
Status: Triage open
Development

No branches or pull requests

4 participants