Skip to main content

wrappingInputRule

@blockslides/core


@blockslides/core / wrappingInputRule

Function: wrappingInputRule()

wrappingInputRule(config): InputRule

Defined in: blockslides/packages/core/src/inputRules/wrappingInputRule.ts:28

Build an input rule for automatically wrapping a textblock when a given string is typed. When using a regular expresion you’ll probably want the regexp to start with ^, so that the pattern can only occur at the start of a textblock.

type is the type of node to wrap in.

By default, if there’s a node with the same type above the newly wrapped node, the rule will try to join those two nodes. You can pass a join predicate, which takes a regular expression match and the node before the wrapped node, and can return a boolean to indicate whether a join should happen.

Parameters

config

find

InputRuleFinder

type

NodeType

keepMarks?

boolean

keepAttributes?

boolean

editor?

SlideEditor

undoable?

boolean

getAttributes?

false | Record<string, any> | (match) => Record<string, any> | null

joinPredicate?

(match, node) => boolean

Returns

InputRule

See

https://tiptap.dev/docs/editor/extensions/custom-extensions/extend-existing#input-rules