[Bug]: Marks for a Mention are not encoded in the Yjs XMLFragment, so formatting of Mentions does not persist/sync with Collaboration #4339
Labels
Category: Open Source
The issue or pull reuqest is related to the open source packages of Tiptap.
Type: Bug
The issue or pullrequest is related to a bug
Which packages did you experience the bug in?
extension-mention, extension-collaboration, starter-kit
What Tiptap version are you using?
2.1.1
What’s the bug you are facing?
Steps to repro:
When you add formatting to text that contains Mentions in Tiptap when not using Collaboration, the Mentions will properly take on any marks (bold, italic, text-style like fontFamily, color, etc.). (This is the expected behavior based on #1387.)
tiptap_mention_formatting_collaboration_bug.webm
However, when using Collaboration/Yjs, the document will initially show the formatted version of the Mention as you make changes locally, but the Marks applied to the Mention will not sync with Yjs. This means:
This appears to be due to the inconsistency between Tiptap/Prosemirror representation of the Mention Node Marks, and the Yjs XMLFragment representation.
What browser are you using?
Chrome
Code example
https://codesandbox.io/s/tiptap-mention-marks-not-serialized-with-yjs-qg4yx6
What did you expect to happen?
"What you see is what you get"—if formatting is shown and applied to a Mention in your instance of the editor due to Marks, it should be synced properly to other users and persist through refreshes. The behavior of formatting Mentions should be consistent between Collaboration mode and non-Collaboration mode.
Anything to add? (optional)
It seems none of the marks of a Mention are included in the YXMLFragment representation, which is seemingly the source of the bug. Compare:
XML (all marks appear after the
<mention>
):Tiptap
getHTML
(Mention is inside<strong>
, etc.):Tiptap
getJSON
(Mention node hasmarks
listed):This bug becomes rather frustrating and limiting when using a FontSize extension like in mui-tiptap, since users will intuitively want/expect a Mention to be able to take on the font size of any neighboring text, even when using Collaboration.
Did you update your dependencies?
Are you sponsoring us?
The text was updated successfully, but these errors were encountered: