[Bug]: Suggestion findSuggestionMatch method doesn't work properly #4033
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
Which packages did you experience the bug in?
Suggestion
What Tiptap version are you using?
2.0
What’s the bug you are facing?
when i am using suggestion for adding a custom node, i can add only one custom node in a paragraph
after add once suggestion doesn't appear again.
What browser are you using?
Chrome
Code example
No response
What did you expect to happen?
i implemented a function node that has some argument nodes as content, and also i have a suggestion for adding a function to document, so my function node isn't a leaf and also isn't a text node so in textBetween function it consider as a empty text
here is textBetween function:
in Suggestion you find text like this:
because of textBetween my function node will convert as empty text, but the function node has a size bigger than zero (2 for function plus 2 for any arguments)
and the bug that i faced is here, where you find the absolute position of the match in the document:
so "from" and "to" here will be wrong because match object that generated base of textBetween, and the match.index always is a number lower than correct position of node,
i believe here we shouldn't use match object to find position.
Anything to add? (optional)
No response
Did you update your dependencies?
Are you sponsoring us?
The text was updated successfully, but these errors were encountered: