docs: make all mark commands a list

This commit is contained in:
Hans Pagel 2021-10-01 23:25:07 +02:00
parent d3aa7903bd
commit 86d8ecd238
9 changed files with 179 additions and 43 deletions

View File

@ -21,11 +21,27 @@ yarn add @tiptap/extension-code
| HTMLAttributes | `Object` | `{}` | Custom HTML attributes that should be added to the rendered HTML tag. |
## Commands
| Command | Parameters | Description |
| ---------- | ---------- | ------------------------- |
| setCode | — | Mark text as inline code. |
| toggleCode | — | Toggle inline code mark. |
| unsetCode | — | Remove inline code mark. |
### setCode()
Mark text as inline code.
```js
editor.commands.setCode()
```
### toggleCode()
Toggle inline code mark.
```js
editor.commands.toggleCode()
```
### unsetCode()
Remove inline code mark.
```js
editor.commands.unsetCode()
```
## Keyboard shortcuts
| Command | Windows/Linux | macOS |

View File

@ -22,11 +22,30 @@ yarn add @tiptap/extension-highlight
| HTMLAttributes | `Object` | `{}` | Custom HTML attributes that should be added to the rendered HTML tag. |
## Commands
| Command | Options | Description |
| --------------- | ------------------ | ------------------------- |
| setHighlight | `color` (optional) | Mark text as highlighted. |
| toggleHighlight | `color` (optional) | Toggle a text highlight. |
| unsetHighlight | — | Removes the highlight. |
### setHighlight()
Mark text as highlighted.
```js
editor.commands.setHighlight()
editor.commands.setHighlight({ color: '#ffcc00' })
```
### toggleHighlight()
Toggle a text highlight.
```js
editor.commands.toggleHighlight()
editor.commands.toggleHighlight({ color: '#ffcc00' })
```
### unsetHighlight()
Removes the highlight.
```js
editor.commands. unsetHighlight()
```
## Keyboard shortcuts
| Command | Windows/Linux | macOS |

View File

@ -25,12 +25,27 @@ yarn add @tiptap/extension-italic
| HTMLAttributes | `Object` | `{}` | Custom HTML attributes that should be added to the rendered HTML tag. |
## Commands
| Command | Parameters | Description |
| ------------ | ---------- | -------------------- |
| setItalic | — | Mark text as italic. |
| toggleItalic | — | Toggle italic mark. |
| unsetItalic | — | Remove italic mark. |
### setItalic()
Mark the text italic.
```js
editor.commands.setItalic()
```
### toggleItalic()
Toggle the italic mark.
```js
editor.commands.toggleItalic()
```
### unsetItalic()
Remove the italic mark.
```js
editor.commands.unsetItalic()
```
## Keyboard shortcuts
| Command | Windows/Linux | macOS |

View File

@ -25,11 +25,29 @@ yarn add @tiptap/extension-link
| linkOnPaste | `Boolean` | `true` | Adds a link to the current selection if the pasted content only contains an url. |
## Commands
| Command | Parameters | Description |
| ---------- | ------------------ | -------------------------------------------- |
| setLink | `href`<br>`target` | Link the selected text. |
| toggleLink | `href`<br>`target` | Add or remove a link from the selected text. |
| unsetLink | | Removes a link. |
### setLink()
Links the selected text.
```js
editor.commands.setLink({ href: 'https://example.com' })
editor.commands.setLink({ href: 'https://example.com', target: '_blank' })
```
### toggleLink()
Adds or removes a link from the selected text.
```js
editor.commands.toggleLink({ href: 'https://example.com' })
editor.commands.toggleLink({ href: 'https://example.com', target: '_blank' })
```
### unsetLink()
Removes a link.
```js
editor.commands.unsetLink()
```
## Keyboard shortcuts
:::warning Doesnt have a keyboard shortcut

View File

@ -25,11 +25,27 @@ yarn add @tiptap/extension-strike
| HTMLAttributes | `Object` | `{}` | Custom HTML attributes that should be added to the rendered HTML tag. |
## Commands
| Command | Parameters | Description |
| ------------ | ---------- | --------------------- |
| setStrike | — | Mark text as striked. |
| toggleStrike | — | Toggle strike mark. |
| unsetStrike | — | Remove strike mark. |
### setStrike()
Mark text as striked.
```js
editor.commands.setStrike()
```
### toggleStrike()
Toggle strike mark.
```js
editor.commands.toggleStrike()
```
### unsetStrike()
Remove strike mark.
```js
editor.commands.unsetStrike()
```
## Keyboard shortcuts
| Command | Windows/Linux | macOS |

View File

@ -19,11 +19,27 @@ yarn add @tiptap/extension-subscript
| HTMLAttributes | `Object` | `{}` | Custom HTML attributes that should be added to the rendered HTML tag. |
## Commands
| Command | Parameters | Description |
| --------------- | ---------- | ----------------------- |
| setSubscript | — | Mark text as subscript. |
| toggleSubscript | — | Toggle subscript mark. |
| unsetSubscript | — | Remove subscript mark. |
### setSubscript()
Mark text as subscript.
```js
editor.commands.setSubscript()
```
### toggleSubscript()
Toggle subscript mark.
```js
editor.commands.toggleSubscript()
```
### unsetSubscript()
Remove subscript mark.
```js
editor.commands.unsetSubscript()
```
## Keyboard shortcuts
| Command | Windows/Linux | macOS |

View File

@ -19,11 +19,27 @@ yarn add @tiptap/extension-superscript
| HTMLAttributes | `Object` | `{}` | Custom HTML attributes that should be added to the rendered HTML tag. |
## Commands
| Command | Parameters | Description |
| ----------------- | ---------- | ------------------------- |
| setSuperscript | — | Mark text as superscript. |
| toggleSuperscript | — | Toggle superscript mark. |
| unsetSuperscript | — | Remove superscript mark. |
### setSuperscript()
Mark text as superscript.
```js
editor.commands.setSuperscript()
```
### toggleSuperscript()
Toggle superscript mark.
```js
editor.commands.toggleSuperscript()
```
### unsetSuperscript()
Remove superscript mark.
```js
editor.commands.unsetSuperscript()
```
## Keyboard shortcuts
| Command | Windows/Linux | macOS |

View File

@ -14,9 +14,13 @@ yarn add @tiptap/extension-text-style
```
## Commands
| Command | Parameters | Description |
| -------------------- | ---------- | --------------------------------------------- |
| removeEmptyTextStyle | | Remove `<span>` tags without an inline style. |
### removeEmptyTextStyle()
Remove `<span>` tags without an inline style.
```js
editor.command.removeEmptyTextStyle()
```
## Source code
[packages/extension-text-style/](https://github.com/ueberdosis/tiptap/blob/main/packages/extension-text-style/)

View File

@ -25,11 +25,27 @@ yarn add @tiptap/extension-underline
| HTMLAttributes | `Object` | `{}` | Custom HTML attributes that should be added to the rendered HTML tag. |
## Commands
| Command | Parameters | Description |
| --------------- | ---------- | ------------------------ |
| setUnderline | — | Mark text as underlined. |
| toggleUnderline | — | Toggle underline mark. |
| unsetUnderline | — | Remove underline mark. |
### setUnderline()
Marks a text as underlined.
```js
editor.commands.setUnderline()
```
### toggleUnderline()
Toggles an underline mark.
```js
editor.commands.toggleUnderline()
```
### unsetUnderline()
Removes an underline mark.
```js
editor.commands.unsetUnderline()
```
## Keyboard shortcuts
| Command | Windows/Linux | macOS |