Pass editor to plugin

Is there a way to pass editor inside apply function of plugin?

   return new Plugin({
      key: new PluginKey('myPLugin'),
      state: {
        init: () => DecorationSet.empty,
        apply(t, set, oldState, newState) {
           I want to have a editor.isEditable here for conditional applying of decorators

No. This is used to update state, which may not even live inside an editor view, so it intentionally doesn’t have access to the view.


Thanks a lot!

1 Like