Skip to content

Comments on custom inline content (no content) are lost on reload and for collaborators #3358

Open

Description

@AntoLC

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 comment mark 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

  1. Start from the comments example (examples/07-collaboration/05-comments).
  2. Add a custom inline content with content: "none" to its schema, e.g. the Mention of examples/06-custom-schema/02-suggestion-menus-mentions.
  3. Write a sentence containing that inline content, select the whole sentence and add a comment.
  4. The sentence, inline content included, is highlighted.
  5. 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
After a reload, only the text keeps the comment highlight, the doc link lost it With the workaround, the doc link keeps the comment highlight after a reload

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 💖

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions