Recently we started using NodeViews for our paragraph nodes.
Question: For a paragraph node I am using nodeView and a plugin which decorates a paragraph node decorator. With both nodeView and node decorator, I am adding a style attribute to the paragraph <p> element.
For example
In Decorator
Decoration.node(from, to, { class: 'para', style: paraStyle })
But I have observed that whatever style attributes I set from my node decorator, get overwritten due to setAttribute on nodeView side. Is there any better way to prevent that situation?
I had a read through few old posts as listed below, but was not entirely sure if they are suggesting an approach to my issue.
What I was hoping for is both the styles from nodeView and node decorator are added up in a string, as described here in the Decorator attrs specs
Interestingly when I set different classes from both places, it does get added up as per my expectation on the DOM, but the same is not seen for styles (maybe due to my setAttribute(style, ’ ') step, it rewrites it).
I can very well try the class approach you said as a workaround, but direct inline styles were the best use for my case.