Plugin onAction method does not have access to view or state

And it feels weird, considering all other props: get “view” as the first parameter.

In my case, i try to port prosemirror 0.10 code where i had a plugin listening selectionChange events, so the new plugin declare a onAction prop and checks action.type == "selection". In the previous version i used to get the view from plugin’s initialization, and it could have been possible to avoid that except for the above remark.

Plugins are not allowed to expose an onAction method at all. Only the main props object can (and must) have that.

I don’t get it, aren’t props passed as argument to new Plugin({ props: { onAction: ...} }) ?

Ok, so i’m supposed to use a StateField… it’s just that the plugin documentation is a bit misleading for rookies.

And i just noticed the

Except for state and onAction, these may also be present on the props property of plugins.

line in the documentation. Maybe the plugins documentation should repeat that piece of information.

Added a note in the plugin docs in this patch