docs(docs): 📝 add missing documentation for commands
This commit is contained in:
@@ -1,5 +1,24 @@
|
||||
# toggleNode
|
||||
`toggleNode` will a node with another node.
|
||||
|
||||
:::warning
|
||||
Oops, we didn’t find time to fill this page. Writing documentation needs attention to detail, a great understanding of the project and time to write. Though Tiptap is used by thousands of developers all around the world, it’s still a side project for us. Let’s change that and make open source our full-time job! [Become a sponsor!](https://github.com/sponsors/ueberdosis)
|
||||
:::
|
||||
## Parameters
|
||||
`typeOrName: string | NodeType`
|
||||
|
||||
The type of node that should be toggled.
|
||||
|
||||
`toggleTypeOrName: string | NodeType`
|
||||
|
||||
The type of node that should be used for the toggling.
|
||||
|
||||
`attributes?: Record<string, any>`
|
||||
|
||||
The attributes that should be applied to the node. **This is optional.**
|
||||
|
||||
## Usage
|
||||
```js
|
||||
// toggle a paragraph with a heading node
|
||||
editor.commands.toggleNode('paragraph', 'heading', { level: 1 })
|
||||
|
||||
// toggle a paragraph with a image node
|
||||
editor.commands.toggleNode('paragraph', 'image', { src: 'https://example.com/image.png' })
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user