Open ederssouza-hotmart opened 2 weeks ago
A mention is an inline node, so it only has a width of one.
The real bug here is that the way that prosemirror does text and the way that tiptap does text is different.
When using .textBetween like the chracter extension does: https://github.com/ueberdosis/tiptap/blob/develop/packages/extension-character-count/dist/index.js#L27
it is unaware that the node can be serialized to text because we do not pass the leafText
to the nodespec in prosemirror here: https://github.com/ueberdosis/tiptap/blob/045d9871f1e8ebd91d02dd322fb1cb39f6a46c51/packages/core/src/helpers/getSchemaByResolvedExtensions.ts#L87-L91
Affected Packages
extension-character-count and extension-mention and suggestion
Version(s)
2.9.1
Bug Description
When using the editor with the extensions
@tiptap/extension-mention
,@tiptap/suggestion
and@tiptap/extension-character-count
the character count does not consider the length of the mention, only the @. The error can be reproduced in the mention extension doc itself https://tiptap.dev/docs/examples/advanced/mentions.Browser Used
Chrome
Code Example URL
https://tiptap.dev/docs/examples/advanced/mentions
Expected Behavior
The character count should be 56 not 44.
Additional Context (Optional)
No response
Dependency Updates