prosekit/extensions/enter-rule
Interfaces
Section titled “Interfaces”EnterRuleHandlerOptions
Section titled “EnterRuleHandlerOptions”Options for EnterRuleHandler.
Properties
Section titled “Properties”-
The current editor state.
-
from:number -
The start position of the matched text.
-
to:number -
The end position of the matched text.
-
match:RegExpExecArray -
The matched result from the regular expression.
Type Aliases
Section titled “Type Aliases”EnterRuleOptions
Section titled “EnterRuleOptions”-
type EnterRuleOptions =EnterRule -
Options for defineEnterRule.
TextBlockEnterRuleOptions
Section titled “TextBlockEnterRuleOptions”-
type TextBlockEnterRuleOptions =_TextBlockEnterRuleOptions -
Options for defineTextBlockEnterRule.
EnterRuleHandler()
Section titled “EnterRuleHandler()”-
type EnterRuleHandler = (options:EnterRuleHandlerOptions) =>Transaction|null|undefined
Functions
Section titled “Functions”defineEnterRule()
Section titled “defineEnterRule()”-
function defineEnterRule(options:EnterRule):PlainExtension -
Defines an enter rule. An enter rule applies when the text directly in front of the cursor matches
regexand user presses Enter. Theregexshould end with$.
defineTextBlockEnterRule()
Section titled “defineTextBlockEnterRule()”-
function defineTextBlockEnterRule(options:TextBlockEnterRuleOptions):PlainExtension -
Defines an enter rule that replaces the matched text with a block node.
See also defineEnterRule.