ueberdosis / tiptap

The headless rich text editor framework for web artisans.
https://tiptap.dev
MIT License
27.55k stars 2.29k forks source link

[Bug]: `isActive` not returning lastest result in `Suggestion.allow` method #5634

Open KeroZhai opened 2 months ago

KeroZhai commented 2 months ago

Affected Packages

Core, Suggestion

Version(s)

2.7.1

Bug Description

I don't want to trigger suggestions in inline code, so I write this:

suggestion: {
  allow: ({ editor }) => {
    return !editor.isActive('code')
  }
}

However, this is not working. It turns out that the result of isActive is incorrect, it returns the state of last cursor location.

Browser Used

Edge

Code Example URL

https://codesandbox.io/p/devbox/stoic-lumiere-p2s5s8

Expected Behavior

isActive returns current state.

Additional Context (Optional)

No response

Dependency Updates

gethari commented 1 month ago

image

I could'nt able to see the suggestion popup inside inlineCode , am I missing something ?

KeroZhai commented 1 month ago

Only spaces are allowed before the @, so in your case it won't trigger the popup.

Just using the provided example:

recording