tiptap/docs/api/commands/set-node.md
2022-06-08 12:15:59 +02:00

510 B

setNode

The setNode command will replace a given range with a given node. The range depends on the current selection. Important: Currently setNode only supports text block nodes.

Parameters

typeOrName: string | NodeType

The type of the node that will replace the range. Can be a string or a NodeType.

attributes?: Record<string, any>

The attributes that should be applied to the node. This is optional.

Usage

editor.commands.setNode("paragraph", { id: "paragraph-01" })