prosekit/extensions/paste-rule
Interfaces
Section titled “Interfaces”MarkPasteRuleOptions
Section titled “MarkPasteRuleOptions”The options for defineMarkPasteRule.
Properties
Section titled “Properties”-
The regular expression to match against. It must have a
gflag to match all instances of the mark.
-
getAttrs?: (match:RegExpExecArray) =>false|Attrs|null|undefined -
A function used to compute attributes to set on the mark created by this rule. When it returns
false, the rule won't match. When it returnsnullorundefined, that is interpreted as an empty/default set of attributes.Default
Section titled “Default”null
-
shouldSkip?: (node:ProseMirrorNode) =>boolean -
Optional function to determine if a text node should be skipped. Default behavior: skip code nodes and nodes that already have the target mark.
PasteRuleHandlerOptions
Section titled “PasteRuleHandlerOptions”Options for PasteRuleHandler.
Properties
Section titled “Properties”-
The editor view.
-
plain:boolean -
Whether the pasted content is treated as plain text. This is true when the
Shiftkey is held when pasting.
PasteRuleOptions
Section titled “PasteRuleOptions”Options for definePasteRule.
Properties
Section titled “Properties”-
A function to be called when a paste rule is triggered.
Type Aliases
Section titled “Type Aliases”PasteRuleHandler()
Section titled “PasteRuleHandler()”-
type PasteRuleHandler = (options:PasteRuleHandlerOptions) =>Slice -
Can be used to transform pasted or dragged-and-dropped content before it is applied to the document.
Functions
Section titled “Functions”defineMarkPasteRule()
Section titled “defineMarkPasteRule()”-
function defineMarkPasteRule(options:MarkPasteRuleOptions):PlainExtension -
Defines a paste rule that applies marks based on regex patterns.
definePasteRule()
Section titled “definePasteRule()”-
function definePasteRule(options:PasteRuleOptions):PlainExtension -
Defines a paste rule. This rule allows you to modify pasted or dragged content before it is inserted into the document.