Access editor attributes from a decorations plugin


#1

I have a plugin which adds a placeholder decoration to the editor, and I’d like to be able to get the content from the editor’s placeholder attribute rather than passing it in as an option to the plugin.

The plugin’s decorations function is only provided with the current state. Is it possible for this decorations function to somehow access the editor’s attributes?


#2

Not currently, though I have opened an issue about it, since this isn’t the first time it comes up.


#3

If I understand the docs for widget Decorations correctly, this should now be possible by passing a function instead of a DOM Node when creating a Widget Decoration. That function will get called with the view and a getPos callback.