mirror of
https://github.com/ueberdosis/tiptap.git
synced 2024-11-24 11:49:02 +08:00
docs(docs): 📝 add missing documentation for commands
This commit is contained in:
parent
43f8843c3e
commit
4abd7c8827
@ -1,5 +1,7 @@
|
||||
# sinkListItem
|
||||
The `sinkListItem` will try to sink the list item around the current selection down into a wrapping child list.
|
||||
|
||||
:::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)
|
||||
:::
|
||||
## Usage
|
||||
```js
|
||||
editor.commands.liftListItem()
|
||||
```
|
||||
|
@ -1,5 +1,16 @@
|
||||
# splitBlock
|
||||
`splitBlock` will split the current node into two nodes at the current [NodeSelection](https://prosemirror.net/docs/ref/#state.NodeSelection). If the current selection is not splittable, the command will be ignored.
|
||||
|
||||
:::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
|
||||
`options: Record<string, any>`
|
||||
|
||||
* `keepMarks: boolean` - Defines if the marks should be kept or removed. Defaults to `true`.
|
||||
|
||||
## Usage
|
||||
```js
|
||||
// split the current node and keep marks
|
||||
editor.commands.splitBlock()
|
||||
|
||||
// split the current node and don't keep marks
|
||||
editor.commands.splitBlock({ keepMarks: false })
|
||||
```
|
||||
|
@ -1,5 +1,12 @@
|
||||
# splitListItem
|
||||
`splitListItem` splits one list item into two separate list items. If this is a nested list, the wrapping list item should be split.
|
||||
|
||||
:::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 split into two separate list items.
|
||||
|
||||
## Usage
|
||||
```js
|
||||
editor.commands.splitListItem('bullet_list')
|
||||
```
|
||||
|
@ -1,5 +1,20 @@
|
||||
# toggleList
|
||||
`toggleList` will toggle between different types of lists.
|
||||
|
||||
:::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
|
||||
`listTypeOrName: string | NodeType`
|
||||
|
||||
The type of node that should be used for the wrapping list
|
||||
|
||||
`itemTypeOrName: string | NodeType`
|
||||
|
||||
The type of node that should be used for the list items
|
||||
|
||||
## Usage
|
||||
```js
|
||||
// toggle a bullet list with list items
|
||||
editor.commands.toggleList('bullet_list', 'list_item')
|
||||
|
||||
// toggle a numbered list with list items
|
||||
editor.commands.toggleList('ordered_list', 'list_item')
|
||||
```
|
||||
|
@ -1,5 +1,26 @@
|
||||
# toggleMark
|
||||
The `toggleMark` command toggles a specific mark on and off at the current selection.
|
||||
|
||||
:::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 | MarkType`
|
||||
|
||||
The type of mark that should be toggled.
|
||||
|
||||
`attributes?: Record<string, any>`
|
||||
|
||||
The attributes that should be applied to the mark. **This is optional.**
|
||||
|
||||
`options?: Record<string, any>`
|
||||
* `extendEmptyMarkRange: boolean` - Removes the mark even across the current selection. Defaults to `false`
|
||||
|
||||
## Usage
|
||||
```js
|
||||
// toggles a bold mark
|
||||
editor.commands.toggleMark('bold')
|
||||
|
||||
// toggles bold mark with a color attribute
|
||||
editor.commands.toggleMark('bold', { color: 'red' })
|
||||
|
||||
// toggles a bold mark with a color attribute and removes the mark across the current selection
|
||||
editor.commands.toggleMark('bold', { color: 'red' }, { extendEmptyMarkRange: true })
|
||||
```
|
||||
|
@ -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' })
|
||||
```
|
||||
|
@ -1,5 +1,17 @@
|
||||
# toggleWrap
|
||||
`toggleWrap` wraps the current node with a new node or removes a wrapping 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 used for the wrapping node.
|
||||
|
||||
`attributes?: Record<string, any>`
|
||||
|
||||
The attributes that should be applied to the node. **This is optional.**
|
||||
|
||||
## Usage
|
||||
```js
|
||||
// toggle wrap the current selection with a heading node
|
||||
editor.commands.toggleWrap('heading', { level: 1 })
|
||||
```
|
||||
|
@ -1,5 +1,7 @@
|
||||
# undoInputRule
|
||||
`undoInputRule` will undo the most recent input rule that was triggered.
|
||||
|
||||
:::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)
|
||||
:::
|
||||
## Usage
|
||||
```js
|
||||
editor.commands.undoInputRule()
|
||||
```
|
||||
|
@ -1,5 +1,7 @@
|
||||
# unsetAllMarks
|
||||
`unsetAllMarks` will remove all marks from the current selection.
|
||||
|
||||
:::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)
|
||||
:::
|
||||
## Usage
|
||||
```js
|
||||
editor.commands.unsetAllMarks()
|
||||
```
|
||||
|
@ -1,5 +1,20 @@
|
||||
# unsetMark
|
||||
`unsetMark` will remove the mark from the current selection. Can also remove all marks across the current selection.
|
||||
|
||||
:::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 | MarkType`
|
||||
|
||||
The type of mark that should be removed.
|
||||
|
||||
`options?: Record<string, any>`
|
||||
|
||||
* `extendEmptyMarkRange?: boolean` - Removes the mark even across the current selection. Defaults to `false`
|
||||
|
||||
## Usage
|
||||
```js
|
||||
// removes a bold mark
|
||||
editor.commands.unsetMark('bold')
|
||||
|
||||
// removes a bold mark across the current selection
|
||||
editor.commands.unsetMark('bold', { extendEmptyMarkRange: true })
|
||||
```
|
||||
|
@ -1,5 +1,17 @@
|
||||
# wrapInList
|
||||
`wrapInList` will wrap a node in the current selection in a list.
|
||||
|
||||
:::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 wrapped in a list.
|
||||
|
||||
`attributes?: Record<string, any>`
|
||||
|
||||
The attributes that should be applied to the list. **This is optional.**
|
||||
|
||||
## Usage
|
||||
```js
|
||||
// wrap a paragraph in a bullet list
|
||||
editor.commands.wrapInList('paragraph')
|
||||
```
|
||||
|
@ -222,39 +222,28 @@
|
||||
link: /api/commands/set-text-selection
|
||||
- title: sinkListItem
|
||||
link: /api/commands/sink-list-item
|
||||
type: draft
|
||||
- title: splitBlock
|
||||
link: /api/commands/split-block
|
||||
type: draft
|
||||
- title: splitListItem
|
||||
link: /api/commands/split-list-item
|
||||
type: draft
|
||||
- title: toggleList
|
||||
link: /api/commands/toggle-list
|
||||
type: draft
|
||||
- title: toggleMark
|
||||
link: /api/commands/toggle-mark
|
||||
type: draft
|
||||
- title: toggleNode
|
||||
link: /api/commands/toggle-node
|
||||
type: draft
|
||||
- title: toggleWrap
|
||||
link: /api/commands/toggle-wrap
|
||||
type: draft
|
||||
- title: undoInputRule
|
||||
link: /api/commands/undo-input-rule
|
||||
type: draft
|
||||
- title: unsetAllMarks
|
||||
link: /api/commands/unset-all-marks
|
||||
type: draft
|
||||
- title: unsetMark
|
||||
link: /api/commands/unset-mark
|
||||
type: draft
|
||||
- title: updateAttributes
|
||||
link: /api/commands/update-attributes
|
||||
- title: wrapInList
|
||||
link: /api/commands/wrap-in-list
|
||||
type: draft
|
||||
- title: Nodes
|
||||
link: /api/nodes
|
||||
items:
|
||||
|
Loading…
Reference in New Issue
Block a user