How can I communicate from a plugin to a custom nodeView?

@rsaccon

Hi Roberto, I am wondering how you got this to work? When I change the decoration prop in a plugin, my nodeViews do not get their update() method called, and when the update() method is called, my decorations argument is always an empty array.

To illustrate I remixed the linter example here: Glitch :・゚✧ I figured the linter example is a good one to use since it has lots of decorations.

The relevant code I added was

line 105

nodeViews: {
        blockquote (node, view, getPos, decorations) { 
            return new BlockView(node, view, getPos, decorations);
        }
    },

and the nodeview

line 84

class BlockView {
    constructor(node, view, getPos, decorations) {
        this.node = node;
        this.getPos = getPos;
        this.dom = document.createElement('blockquote');
        this.contentDOM = this.dom;
    }
    update(node, decos) {
        console.log('decos', decos);

        this.node = node;
        return true;
    }
}

When I run the example and create a blockquote nodeView, the decorations are not passed in the update method. Also, if the decorations are changed via the plugin, update() is not called on the nodeView. I have seen the same outcome for several examples I have run, not just the remixed example above.

I think I am missing something here. Are you directly calling the update() method on the nodeView? Any insights would be greatly appreciated.