[BREAKING CHANGE] change the default document type to doc
This commit is contained in:
@@ -32,7 +32,7 @@ When you’ll work with the provided extensions only, you don’t have to care t
|
||||
}
|
||||
```
|
||||
|
||||
We register three nodes here. `document`, `paragraph` and `text`. `document` is the root node which allows one or more block nodes as children (`content: 'block+'`). Since `paragraph` is in the group of block nodes (`group: 'block'`) our document can only contain paragraphs. Our paragraphs allow zero or more inline nodes as children (`content: 'inline*'`) so there can only be `text` in it. `parseDOM` defines how a node can be parsed from pasted HTML. `toDOM` defines how it will be rendered in the DOM.
|
||||
We register three nodes here. `doc`, `paragraph` and `text`. `doc` is the root node which allows one or more block nodes as children (`content: 'block+'`). Since `paragraph` is in the group of block nodes (`group: 'block'`) our document can only contain paragraphs. Our paragraphs allow zero or more inline nodes as children (`content: 'inline*'`) so there can only be `text` in it. `parseDOM` defines how a node can be parsed from pasted HTML. `toDOM` defines how it will be rendered in the DOM.
|
||||
|
||||
In tiptap every node, mark and extension is living in its own file. This allows us to split the logic. Under the hood the whole schema will be merged together:
|
||||
|
||||
@@ -41,7 +41,7 @@ In tiptap every node, mark and extension is living in its own file. This allows
|
||||
import { Node } from '@tiptap/core'
|
||||
|
||||
const Document = Node.create({
|
||||
name: 'document',
|
||||
name: 'doc',
|
||||
topNode: true,
|
||||
content: 'block+',
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user