tiptap/docs/src/docPages/api/nodes.md
2021-02-04 17:33:59 +01:00

4.4 KiB
Raw Blame History

Nodes

toc

Introduction

Nodes add new capabilities to tiptap. Nodes are like block types, for example a paragraph, heading, or code block.

List of supported nodes

Title Default Extension Source Code
Blockquote Yes GitHub
BulletList Yes GitHub
CodeBlock Yes GitHub
Document Yes GitHub
Emoji GitHub
HardBreak Yes GitHub
Hashtag GitHub
Heading Yes GitHub
HorizontalRule GitHub
Image GitHub
ListItem Yes GitHub
Mention Yes GitHub
OrderedList Yes GitHub
Paragraph Yes GitHub
Table GitHub
TableRow GitHub
TableCell GitHub
TaskList GitHub
TaskItem GitHub
Text Yes GitHub

Create a new node

Youre free to create your own nodes for tiptap. Here is the boilerplate code thats need to create and register your own node:

import { Node } from '@tiptap/core'

const CustomNode = Node.create({
  // Your code here
})

const editor = new Editor({
  extensions: [
    // Register your custom node with the editor.
    CustomNode,
    // … and dont forget all other extensions.
    Document,
    Paragraph,
    Text,
    // …
  ],

Learn more about custom extensions in our guide.