docs: update content
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
# clearNodes
|
# clearNodes
|
||||||
The `clearNodes` command normalizes nodes to a simple paragraph, it even normalizes all kind of lists. For advanced use cases it can come in handy, before applying a new node type.
|
The `clearNodes` command normalizes nodes to the default node, which is the paragraph by default. It’ll even normalize all kind of lists. For advanced use cases it can come in handy, before applying a new node type.
|
||||||
|
|
||||||
|
If you wonder how you can define the default node: It depends on what’s in the `content` attribute of your [`Document`](/api/nodes/document), by default that’s `block+` (at least one block node) and the [`Paragraph`](/api/nodes/paragraph) node has the highest priority, so it’s loaded first and is therefore the default node.
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
```js
|
```js
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ The extension name is used in a whole lot of places and changing it isn’t too
|
|||||||
The extension name is also part of the JSON. If you [store your content as JSON](/guide/output#option-1-json), you need to change the name there too.
|
The extension name is also part of the JSON. If you [store your content as JSON](/guide/output#option-1-json), you need to change the name there too.
|
||||||
|
|
||||||
### Priority
|
### Priority
|
||||||
With the priority you can specify the order of the extensions. This has an impact on the schema and ProseMirror plugins. Default priority is `100`. A higher value means that the extension will be loaded earlier.
|
The priority defines the order in which extensions are registered. The default priority is `100`, that’s what most extension have. Extensions with a higher priority will be loaded earlier.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
import Link from '@tiptap/extension-link'
|
import Link from '@tiptap/extension-link'
|
||||||
@@ -50,6 +50,10 @@ const CustomLink = Link.extend({
|
|||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
|
The order in which extensions are loaded influences a few things.
|
||||||
|
|
||||||
|
For example the output. The [`Link`](/api/marks/link) mark has a higher priority, which means it’ll be rendered as `<a href="…"><strong>Example</strong></a>` instead of `<strong><a href="…">Example</></strong>`.
|
||||||
|
|
||||||
### Settings
|
### Settings
|
||||||
All settings can be configured through the extension anyway, but if you want to change the default settings, for example to provide a library on top of tiptap for other developers, you can do it like that:
|
All settings can be configured through the extension anyway, but if you want to change the default settings, for example to provide a library on top of tiptap for other developers, you can do it like that:
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user