Feature request: could nodeView#dom be set by default?

Hi,

Using a nodeView on a leaf node, basically just to benefit from stopEvent. This nodeView doesn’t define itself the dom property, because the default is all right. However, the default ‘dom’ is not accessible to the nodeView. Is it on purpose ? Could the default dom be accessible to the nodeView ? Currently i’m using getPos and domAtPos to get it, but it feels like overkill.

I can’t imagine how that works. At the point where you’re constructing the node view, there’s no DOM for the node available yet, is there?

The default DOM isn’t created when there’s a node view, because the node view is the one who’s going to supply the DOM. You could use renderSpec to render a node type’s toDOM yourself, and use that as the dom propery, if you want to. I don’t think this warrants library support—most node views will want their own DOM, and even those that don’t usually need at least access to that DOM in their constructor, which you wouldn’t get in a system where the library constructs it after the constructor runs.

I don’t call them during construction, but rather in stopEvent or ignoreMutation.

That’s fine.

That probably what i am looking after :slight_smile: