improve commands page, add api overview
This commit is contained in:
@@ -1,65 +1,35 @@
|
|||||||
# Commands
|
# Commands
|
||||||
|
|
||||||
:::warning Out of date
|
## Chain commands
|
||||||
This content is written for tiptap 1 and needs an update.
|
|
||||||
:::
|
|
||||||
|
|
||||||
- menus
|
```js
|
||||||
- buttons
|
editor.chain().focus().bold().run()
|
||||||
- commands
|
```
|
||||||
|
|
||||||
## .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.
|
### Selection
|
||||||
|
| Command | Description |
|
||||||
## .focus()
|
| ------------------ | --------------------------------------- |
|
||||||
|
| .deleteSelection() | Delete the selection, if there is one. |
|
||||||
Focus the editor at the given position.
|
| .focus() | Focus the editor at the given position. |
|
||||||
|
| .selectAll() | Select 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.
|
|
||||||
|
|
||||||
## .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.
|
|
||||||
|
|||||||
15
docs/src/docPages/api/overview.md
Normal file
15
docs/src/docPages/api/overview.md
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
# Overview
|
||||||
|
|
||||||
|
* tiptap is a friendly wrapped around ProseMirror.
|
||||||
|
* ProseMirror works with a strict [Schema](/api/schema), which defines the allowed structure of a document.
|
||||||
|
* A document is a tree of headings, paragraphs and others elements, so called nodes.
|
||||||
|
* Marks can be attached to a node, e. g. to emphasize part of it.
|
||||||
|
* [Commands](/api/commands) change that document programmatically.
|
||||||
|
* The document is stored in a state.
|
||||||
|
* All changes are applied as transactions to the state.
|
||||||
|
* The state has details about the current content, cursor position and selection.
|
||||||
|
* You can hook into a few different [events](/api/events), for example to alter transactions before they get applied.
|
||||||
|
* [Extensions](/api/extensions) add functionality like nodes, marks and/or commands to the editor.
|
||||||
|
* A huge amount of commands are bound to common [keyboard shortcuts](/api/keyboard-shortcuts).
|
||||||
|
|
||||||
|
All of those concepts are explained in detail on the following pages.
|
||||||
@@ -105,10 +105,12 @@
|
|||||||
|
|
||||||
- title: API
|
- title: API
|
||||||
items:
|
items:
|
||||||
|
- title: Overview
|
||||||
|
link: /api/overview
|
||||||
- title: Editor
|
- title: Editor
|
||||||
link: /api/editor/
|
link: /api/editor
|
||||||
- title: Extensions
|
- title: Extensions
|
||||||
link: /api/extensions/
|
link: /api/extensions
|
||||||
items:
|
items:
|
||||||
- title: Blockquote
|
- title: Blockquote
|
||||||
link: /api/extensions/blockquote
|
link: /api/extensions/blockquote
|
||||||
@@ -176,7 +178,6 @@
|
|||||||
link: /api/extensions/underline
|
link: /api/extensions/underline
|
||||||
- title: Commands
|
- title: Commands
|
||||||
link: /api/commands
|
link: /api/commands
|
||||||
draft: true
|
|
||||||
- title: Events
|
- title: Events
|
||||||
link: /api/events
|
link: /api/events
|
||||||
- title: Schema
|
- title: Schema
|
||||||
|
|||||||
Reference in New Issue
Block a user