improve commands page, add api overview

This commit is contained in:
Hans Pagel
2020-09-24 21:41:35 +02:00
parent 27fcc9a467
commit a12b09f1b7
3 changed files with 47 additions and 61 deletions

View File

@@ -1,65 +1,35 @@
# Commands
:::warning Out of date
This content is written for tiptap 1 and needs an update.
:::
## Chain commands
- menus
- buttons
- commands
```js
editor.chain().focus().bold().run()
```
## .clearContent()
## List of commands
Clear the whole document.
### Content
| Command | Description |
| --------------- | ----------------------------------------------------------- |
| .clearContent() | Clear the whole document. |
| .insertHTML() | Insert a string of HTML at the currently selected position. |
| .insertText() | Insert a string of text at the currently selected position. |
| .setContent() | Replace the whole document with new content. |
## .deleteSelection()
### Nodes & Marks
| Command | Description |
| ------------------- | ------------------------------------------ |
| .removeMark() | Remove a mark in the current selection. |
| .removeMarks() | Remove all marks in the current selection. |
| .replaceWithNode() | Replace a given range with a node. |
| .selectParentNode() | Select the parent node. |
| .toggleMark() | Toggle a mark on and off. |
| .toggleNode() | Toggle a node with another node. |
| .updateMark() | Update a mark with new attributes. |
Delete the selection, if there is one.
## .focus()
Focus the editor at the given position.
## .insertHTML()
Insert a string of HTML at the currently selected position.
## .insertText()
Insert a string of text at the currently selected position.
## .removeMark()
Remove a mark in the current selection.
## .removeMarks()
Remove all marks in the current selection.
## .replaceWithNode()
Replace a given range with a node.
## .selectAll()
Select the whole document.
## .selectParentNode()
Select the parent node.
## .setContent()
Replace the whole document with new content.
## .toggleMark()
Toggle a mark on and off.
## .toggleNode()
Toggle a node with another node.
## .updateMark()
Update a mark with new attributes.
### Selection
| Command | Description |
| ------------------ | --------------------------------------- |
| .deleteSelection() | Delete the selection, if there is one. |
| .focus() | Focus the editor at the given position. |
| .selectAll() | Select the whole document. |