Skip to content

prosekit/extensions/autocomplete

AutocompleteRule

constructor

new AutocompleteRule(options: { canMatch?: (options: { state: EditorState }) => boolean; onEnter: MatchHandler; onLeave?: VoidFunction; regex: RegExp }): AutocompleteRule

canMatch

Type: (options: { state: EditorState }) => boolean

onLeave

Type: VoidFunction

onMatch

Type: MatchHandler

regex

Type: RegExp

MatchHandler

Type: (options: { deleteMatch: () => void; from: number; ignoreMatch: () => void; match: RegExpExecArray; state: EditorState; to: number }) => void

defineAutocomplete

ts
function defineAutocomplete(rule: AutocompleteRule): Extension