Is it possible change HTML attributes on a mark using decorations? I see one can add a class to a node using Decoration.node
, and there’s Decoration.inline
but this nests a span
within the mark. I want to modify the mark’s class
so I can adjust its styling.
Here’s the use case: Users can add comments to the document which are tracked using marks. When a user clicks on a comment (outside of the editor) I want to highlight the comment in the editor by darkening the background color. I tried manually adding highlight
class to the DOM but have noticed some issues and, from my understanding, we’re not supposed to edit the DOM directly.
I could add a highlight
attribute to the mark but this would be synced with collaborators and persisted in the document. I want highlighting to be a visual indicator for the one user.
Any ideas how to achieve this?