tiptap icon indicating copy to clipboard operation
tiptap copied to clipboard

[Bug]: still missing type editor.chain().focus().toggleBold()

Open CooperHash opened this issue 9 months ago • 2 comments

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. 💖

CooperHash avatar May 02 '24 13:05 CooperHash

I am getting this error with toggleUnderline() instead of toggleBold()

JacobGuiang avatar May 09 '24 17:05 JacobGuiang

ok thanks

CooperHash avatar May 10 '24 02:05 CooperHash

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.

JacobGuiang avatar May 13 '24 17:05 JacobGuiang

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

nperez0111 avatar May 23 '24 17:05 nperez0111