Properties

@zentara/plugin-suggestions provides the following properties:

triggers
string[]
required

The triggers to show suggestions.

Example: ['{', '{{', '{{.']

suggestions
string[]
required

The suggestions to show.

Example: ['foo', 'bar', 'baz']

transform
(selelcted: string) => string

The transform function to transform the suggestion.

When the user selects a suggestion, the transform function is called with the selected suggestion and the transform function returns the transformed suggestion.

example
// when the user selects 'foo',
// suggestionPlugin inserts '{{.foo}}' into the input
(selelcted) => `{{.${selelcted}}}`;
renderSuggestion
(suggestion: string) => ReactNode

The render function to render the suggestion. User can decide how to show the suggestion list.

example
(emojiName) => <div>{emojis[emojiName]}</div>;
maxSuggestions
number
default:5

The maximum number of suggestions to show.

Example: 10

suggestionsListOffset
number
default:0

The offset of the suggestions list.

Example: 8