tiptap/docs/src/docPages/api/nodes/document.md

24 lines
1.1 KiB
Markdown
Raw Normal View History

2020-09-09 21:58:06 +08:00
# Document
**The `Document` extension is required**, no matter what you build with tiptap. Its a so called “topNode”, a node thats the home to all other nodes. Think of it like the `<body>` tag for your document.
The node is very tiny though. It defines a name of the node (`document`), is configured to be a top node (`topNode: true`) and that it can contain multiple other nodes (`block`). Thats all. But have a look yourself:
:::warning Breaking Change from 1.x → 2.x
2020-10-30 23:13:47 +08:00
tiptap 1 tried to hide that node from you, but it has always been there. A tiny, but important change though: **We renamed the default type from `doc` to `document`.** To keep it like that, use your own implementation of the `Document` node or migrate the stored JSON to use the new name.
2020-09-09 21:58:06 +08:00
:::
## Installation
```bash
2020-10-30 21:24:16 +08:00
# with npm
npm install @tiptap/extension-document
2020-10-30 21:24:16 +08:00
# with Yarn
yarn add @tiptap/extension-document
```
2020-09-21 22:59:28 +08:00
## Source code
2020-09-09 21:58:06 +08:00
[packages/extension-document/](https://github.com/ueberdosis/tiptap-next/blob/main/packages/extension-document/)
## Usage
2020-10-30 21:24:16 +08:00
<demo name="Extensions/Document" highlight="10,28" />