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

Refocus the editor after applying style #409

Open
WhiteSage opened this issue Dec 30, 2024 · 0 comments
Open

Refocus the editor after applying style #409

WhiteSage opened this issue Dec 30, 2024 · 0 comments

Comments

@WhiteSage
Copy link

WhiteSage commented Dec 30, 2024

After clicking the toolbar style buttons (bold, italics, etc) the button is left focused and pressing any key will not result in writing. The fix is simple: in each of your extensions file, redefine the action to chain the focus command:

Instead of
action: () => editor.commands.toggleBold(),
Use
action: () => editor.chain().focus().toggleBold().run(),

Note this is the way it is done in all the official examples in the tiptap webpage (1). Sorry I don't have the time to submit a PR.

  1. https://tiptap.dev/docs/editor/api/commands/selection/focus
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

No branches or pull requests

1 participant