The problem I am facing
I'm implementing a Mention-like Extension using the Suggestion-Plugin and would like to access its internal state and/or trigger its methods. In my case i would like to use an Escape-KeyboardShortCut to close the Suggestion if it's active.
The solution I would like
A way to access the internal state and/or methods of the plugin.
Alternatives I have considered
Implementing the functionality inside the render function of the Suggestion – but i think that function should really only be handling the visual representation of the Suggestion.
Additional context
Internal state is accessible on state.suggestion$, but i don't think that it is meant to be accessed directly (https://github.com/ueberdosis/tiptap/blob/main/packages/suggestion/src/suggestion.ts#L130).
addKeyboardShortcuts () {
return {
Escape: () => this.editor.commands.command(({ tr, state }) => {
// How to access `active` on the internal state?
// How to 'close' the suggestion if active?
}),
}
},
The problem I am facing
I'm implementing a
Mention-like Extension using theSuggestion-Plugin and would like to access its internal state and/or trigger its methods. In my case i would like to use anEscape-KeyboardShortCutto close theSuggestionif it's active.The solution I would like
A way to access the internal state and/or methods of the plugin.
Alternatives I have considered
Implementing the functionality inside the render function of the
Suggestion– but i think that function should really only be handling the visual representation of theSuggestion.Additional context
Internal state is accessible on
state.suggestion$, but i don't think that it is meant to be accessed directly (https://github.com/ueberdosis/tiptap/blob/main/packages/suggestion/src/suggestion.ts#L130).