I have a couple of controls (such as drag handles for resizing images and tables) that should only be there if the editor view currently has focus or not. Another example is a “fake selection” decoration that should make the current text selection visible if focus is somewhere outside the editor, but let the browser handle the selection highlighting if the editor does have focus.
I am not sure how to handle these kinds of things with the ProseMirror architecture. Focus is not part of the editor state, it seems like it is only manifested in the CSS class on the editor and the
hasFocus() API. There does not seem to be a good way for plugins to actually respond to focus changes. I don’t really want to do this with CSS, because I am afraid that e.g. the mere presence of the fake selection decoration (even if made invisible through CSS) could mess up or at least complicate editing operations. In other cases, the controls are actually outside of the editor view DOM element.
Best regards, Chris