tiptap
tiptap copied to clipboard
[Bug]: still missing type editor.chain().focus().toggleBold()
Which packages did you experience the bug in?
react
What Tiptap version are you using?
2.3.1
What’s the bug you are facing?
<button
onClick={() => editor.chain().focus().toggleBold().run()}
disabled={
!editor.can()
.chain()
.focus()
.toggleBold()
.run()
}
className={editor.isActive('bold') ? 'is-active' : ''}
>
Property 'toggleBold' does not exist on type 'ChainedCommands'. Did you mean 'toggleNode'?ts(2551)
What browser are you using?
Chrome
Code example
No response
What did you expect to happen?
it should not happend, it should have this type
Anything to add? (optional)
No response
Did you update your dependencies?
- [X] Yes, I’ve updated my dependencies to use the latest version of all packages.
Are you sponsoring us?
- [ ] Yes, I’m a sponsor. 💖
I am getting this error with toggleUnderline() instead of toggleBold()
ok thanks
I am getting this error with toggleUnderline() instead of toggleBold()
I was getting the error with toggleUnderline because I didn't realize the Underline extension was not included in StarterKit. I had to add Underline to my extensions.
The types only apply when you have that extension installed. The type definitely is there: https://github.com/ueberdosis/tiptap/blob/main/packages/extension-bold/src/bold.ts#L27