JSONContent
type JSONContent = { [key: string]: any; attrs?: Record<string, any>; content?: JSONContent[]; marks?: { [key: string]: any; attrs?: Record<string, any>; type: string; }[]; text?: string; type?: string;};A Tiptap JSON node or document. Tiptap JSON is the standard format for storing and manipulating Tiptap content. It is equivalent to the JSON representation of a Prosemirror node.
Tiptap JSON documents are trees of nodes. The root node is usually of type
doc. Nodes can have other nodes as children. Nodes can also have marks and
attributes. Text nodes (nodes with type text) have a text property and no
children.
Example
Section titled “Example”const content: JSONContent = { type: "doc", content: [ { type: "paragraph", content: [ { type: "text", text: "Hello ", }, { type: "text", text: "world", marks: [{ type: "bold" }], }, ], }, ],};Indexable
Section titled “Indexable”[key: string]: anyProperties
Section titled “Properties”| Property | Type | Description |
|---|---|---|
attrs? |
Record<string, any> |
The attributes of the node. Attributes can have any JSON-serializable value. |
content? |
JSONContent[] |
The children of the node. A node can have other nodes as children. |
marks? |
{ [key: string]: any; attrs?: Record<string, any>; type: string; }[] |
A list of marks of the node. Inline nodes can have marks. |
text? |
string |
The text content of the node. This property is only present on text nodes (i.e. nodes with type: 'text'). Text nodes cannot have children, but they can have marks. |
type? |
string |
The type of the node |