feat!: Add editor to items prop in suggestion plugin (#2082)

* add editor to items prop

* docs: update content
This commit is contained in:
Philipp Kühn
2021-10-25 09:42:41 +02:00
committed by GitHub
parent c01afc6791
commit a6f731af39
6 changed files with 13 additions and 7 deletions

View File

@@ -17,7 +17,10 @@ export interface SuggestionOptions {
range: Range,
props: any,
}) => void,
items?: (query: string) => any[] | Promise<any[]>,
items?: (props: {
query: string,
editor: Editor,
}) => any[] | Promise<any[]>,
render?: () => {
onStart?: (props: SuggestionProps) => void,
onUpdate?: (props: SuggestionProps) => void,
@@ -99,7 +102,10 @@ export function Suggestion({
query: state.query,
text: state.text,
items: (handleChange || handleStart)
? await items(state.query)
? await items({
editor,
query: state.query,
})
: [],
command: commandProps => {
command({