mirror of
https://github.com/ueberdosis/tiptap.git
synced 2024-12-01 09:29:02 +08:00
5.3 KiB
5.3 KiB
tableOfContents |
---|
true |
Nodes
Introduction
If you think of the document as a tree, then nodes are just a type of content in that tree. Examples of nodes are paragraphs, headings, or code blocks. But nodes don’t have to be blocks. They can also be rendered inline with the text, for example for @mentions.
List of supported nodes
Title | StarterKit (view) | Source Code |
---|---|---|
Blockquote | Included | GitHub |
BulletList | Included | GitHub |
CodeBlock | Included | GitHub |
Document | Included | GitHub |
Emoji | – | GitHub |
HardBreak | Included | GitHub |
Hashtag | – | GitHub |
Heading | Included | GitHub |
HorizontalRule | Included | GitHub |
Image | – | GitHub |
ListItem | Included | GitHub |
Mention | Included | GitHub |
OrderedList | Included | GitHub |
Paragraph | Included | GitHub |
Table | – | GitHub |
TableRow | – | GitHub |
TableCell | – | GitHub |
TaskList | – | GitHub |
TaskItem | – | GitHub |
Text | Included | GitHub |
YouTube | Included | GitHub |
Create a new node
You’re free to create your own nodes for Tiptap. Here is the boilerplate code that’s 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 don’t forget all other extensions.
Document,
Paragraph,
Text,
// …
],
})