mirror of
https://github.com/ueberdosis/tiptap.git
synced 2024-11-25 12:39:03 +08:00
569aa15c4f
# Conflicts: # docs/experiments/collaboration-annotation.md # docs/experiments/global-drag-handle.md
5.1 KiB
5.1 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 |
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,
// …
],
})