Repository navigation
Open
Description
What’s broken?
A comment that covers a custom inline content with content: 'none' (e.g. a mention or a link to another document) is lost on that inline content after a reload, and the other collaborators never see it on it:
- the
commentmark is set on the inline node itself; - y-prosemirror only stores the attributes of element nodes in Yjs, never their marks, so the mark only lives in the local editor state;
- when the document is rebuilt from Yjs (reload, another client), the inline content has no highlight anymore, and a thread anchored only on it loses its anchor.
The text around it keeps its highlight, because the marks of text nodes are stored in Yjs.
What did you expect to happen?
The comment highlight on a custom inline content survives a reload and is shown to the collaborators, like the one on text.
Steps to reproduce
- Start from the comments example (
examples/07-collaboration/05-comments). - Add a custom inline content with
content: "none"to its schema, e.g. theMentionofexamples/06-custom-schema/02-suggestion-menus-mentions. - Write a sentence containing that inline content, select the whole sentence and add a comment.
- The sentence, inline content included, is highlighted.
- Reload the page (or open the document in a second client): the text is still highlighted, the inline content is not.
BlockNote version
0.57.0
Environment
Chromium, Windows 11, React 19.3, Next.js 16.4, y-prosemirror 1.3.7, yjs 13.6.33, prosemirror-model 1.25.12
Additional context
The sentence "link to [doc link]" was commented as a whole, then the page was reloaded (screenshots from La Suite Docs, where the doc link is a custom inline content with content: "none"):
| After a reload | After a reload, with our workaround |
|---|---|
![]() |
![]() |
- Root cause in y-prosemirror:
createTypeFromElementNodeonly copies the node attributes to theY.XmlElement, andcreateNodeFromYElementrebuilds the node withschema.node(el.nodeName, attrs, children), without marks. Supporting marks on element nodes there was declined: Does not support marks on non-TextNodes yjs/y-prosemirror#47 (closed as not planned). - Inline content with content, like inline math (
content: 'plain'), is not affected: the mark sits on its text, which Yjs stores. - Our workaround in La Suite Docs (🐛(frontend) keep comments on inline nodes after a reload suitenumerique/docs#2898, reported in 🐛(Bug) Comments on inline nodes (doc links, math) are lost on reload suitenumerique/docs#2878): a ProseMirror plugin mirrors the
commentmarks of these inline nodes into a hidden node attribute, which Yjs stores, and restores the marks from it on Yjs transactions (ySyncPluginKeymetaisChangeOrigin). It works, but it belongs inCommentsExtension: could BlockNote handle this natively?
Contribution
- I'd be interested in contributing a fix for this issue
Sponsor
- I'm a sponsor and would appreciate if you could look into this sooner than later 💖
Metadata
Metadata
Assignees
Labels
No labels


Activity