Is it possible to access the current editor state from a node spec’s
Here is my use case. I’m new to ProseMirror so maybe I’m way off the rails here…
When I create a new editor I have specific state (an asset library) that I need to associate with the editor. It’s not global to the app, it’s specific to this one instance of an editor. When my custom nodes render toDOM they need to be able to access this editor-specific state.
To get it working I created a plugin that holds the editor specific state. It has a nodeView for my custom node that just adds a reference to the plugin state to each node. This “works”, but feels hacky and roundabout. Also, the nodeView doesn’t seem to run if I try to use a
DOMSerializer on a state that has never been in an
EditorView so this solution might not even totally work for me.
Is there a better way to accomplish what I need?