add editor to suggestion command props

This commit is contained in:
Philipp Kühn
2021-01-20 09:23:44 +01:00
parent 1c424f4db1
commit ba0d379101
2 changed files with 18 additions and 10 deletions

View File

@@ -9,7 +9,11 @@ export interface SuggestionOptions {
allowSpaces?: boolean,
startOfLine?: boolean,
suggestionClass?: string,
command?: (props: { range: Range, attributes: AnyObject }) => void,
command?: (props: {
editor: Editor,
range: Range,
attributes: AnyObject
}) => void,
items?: (query: string) => any[],
render?: () => {
onStart?: (props: SuggestionProps) => void,
@@ -83,7 +87,11 @@ export function Suggestion({
? await items(state.query)
: [],
command: attributes => {
command({ range: state.range, attributes })
command({
editor,
range: state.range,
attributes,
})
},
decorationNode,
// virtual node for popper.js or tippy.js