I am just updating the document attribute collaboratively and it’s working fine. But based on this document attribute, I need to re-render all the nodes. Since there is no other UI change it looks like rendering is not happening with this. How do I force rendering both locally & collaboratively? Thanks in advance!
Hi I am also looking for a solution for the same use case…
What does ‘updating the document attribute’ mean, precisely?
Thanks for responding! It is updating the top-level document node’s attribute.
How? What does the code look like?
When a user selects an item in the menu displayed by a (prosemirror) plugin, a document node attribute step transaction is fired. This updated document node’s attribute good. Based on this updated attribute, each paragraph node’s rendering depends, which is not happening with this. If I type in any characters ie making an update to any paragraph it renders correctly, but I want all the paragraphs’ node’s to be rendered without user intervention. This paragraph uses a custom node view in the plugin to render as desired. Assume making the editor’s doc view’s content dirty will render automatically?
A paragraph’s rendered HTML looks like this:
<p stylename="None" custom="XXX" style="user-select: none;"><span contenteditable="false" class="custom" style="color: black;">(XXX) </span><span class="text">Hello</span></p>
Out of this <span contenteditable="false" class="custom" style="color: black;">(XXX) </span>
is rendered based on the document node’s attribute ie XXX is value is changed based on that attribute.
At a glance it seems like the node.sameMarkup
check in NodeViewDesc.update
should return false
causing a full redraw in this situation. You could try investigating why that isn’t happening.
I already had investigated that. NodeViewDesc.update
isn’t even called, b’coz I believe there are no changes made to the paragraph nodes.
That’s weird. Did you declare your attributes in the schema? When the document changes, EditorView.updateStateInner
should definitely call NodeViewDesc.update
.
Yes, attributes are declared in the schema and attributes values are set to fine, but rendering of each paragraph node is not happening.