How to call view.nodeDOM in Decoration.widget

Glitch remix: Glitch :・゚✧

I want to use EditorView.nodeDOM in Decoration.Widget toDOM. This is to get offsetHeight of the DOM and determine the height of the decoration.

However, when I reload browser and toDOM is called, an error occurs because there is no view.docView.

Is there any way to delay the rendering of decorations until the docView is added, or hook the addition of the docView to regenerate the decorations?

That seems like an extremely problematic idea. As you found, at the time when nodes are rendered, there is no guarantee at all about what will be present in the DOM, so you really shouldn’t depend on that there.

1 Like

oh, thanks reply. I will try to come up with another approach.