docs: update content, add new commands pages
This commit is contained in:
@@ -151,10 +151,10 @@ Have a look at all of the core commands listed below. They should give you a goo
|
|||||||
| Command | Description | Links |
|
| Command | Description | Links |
|
||||||
| --------------- | ------------------------------------------------ | ----------------------------------- |
|
| --------------- | ------------------------------------------------ | ----------------------------------- |
|
||||||
| .clearContent() | Clear the whole document. | [More](/api/commands/clear-content) |
|
| .clearContent() | Clear the whole document. | [More](/api/commands/clear-content) |
|
||||||
| .insertHTML() | Insert a string of HTML at the current position. | |
|
| .insertHTML() | Insert a string of HTML at the current position. | [More](/api/commands/insert-html) |
|
||||||
| .insertNode() | Insert a node at the current position. | |
|
| .insertNode() | Insert a node at the current position. | [More](/api/commands/insert-node) |
|
||||||
| .insertText() | Insert a string of text at the current position. | |
|
| .insertText() | Insert a string of text at the current position. | [More](/api/commands/insert-text) |
|
||||||
| .setContent() | Replace the whole document with new content. | |
|
| .setContent() | Replace the whole document with new content. | [More](/api/commands/set-content) |
|
||||||
|
|
||||||
### Nodes & Marks
|
### Nodes & Marks
|
||||||
| Command | Description |
|
| Command | Description |
|
||||||
|
|||||||
12
docs/src/docPages/api/commands/clear-content.md
Normal file
12
docs/src/docPages/api/commands/clear-content.md
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
# clearContent
|
||||||
|
|
||||||
|
See also: [setContent](/api/commands/set-content)
|
||||||
|
|
||||||
|
## Parameters
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
```js
|
||||||
|
this.editor.commands.clearContent()
|
||||||
|
```
|
||||||
|
|
||||||
13
docs/src/docPages/api/commands/insert-html.md
Normal file
13
docs/src/docPages/api/commands/insert-html.md
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
# insertHTML
|
||||||
|
|
||||||
|
|
||||||
|
See also: [insertText](/api/commands/insert-text), [insertNode](/api/commands/insert-node)
|
||||||
|
|
||||||
|
## Parameters
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
```js
|
||||||
|
this.editor.commands.insertHTML('<p>Example text</p>')
|
||||||
|
```
|
||||||
|
|
||||||
13
docs/src/docPages/api/commands/insert-node.md
Normal file
13
docs/src/docPages/api/commands/insert-node.md
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
# insertNode
|
||||||
|
|
||||||
|
|
||||||
|
See also: [insertHTML](/api/commands/insert-html), [insertText](/api/commands/insert-text)
|
||||||
|
|
||||||
|
## Parameters
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
```js
|
||||||
|
this.editor.commands.insertNode('paragraph')
|
||||||
|
```
|
||||||
|
|
||||||
12
docs/src/docPages/api/commands/insert-text.md
Normal file
12
docs/src/docPages/api/commands/insert-text.md
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
# insertText
|
||||||
|
|
||||||
|
See also: [insertHTML](/api/commands/insert-html), [insertNode](/api/commands/insert-node)
|
||||||
|
|
||||||
|
## Parameters
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
```js
|
||||||
|
this.editor.commands.insertText('Example text')
|
||||||
|
```
|
||||||
|
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
# setContent
|
# setContent
|
||||||
The `setContent` command replaces the document with a new one. You can pass JSON or HTML, both work fine. It’s basically the same as setting the `content` on initialization.
|
The `setContent` command replaces the document with a new one. You can pass JSON or HTML, both work fine. It’s basically the same as setting the `content` on initialization.
|
||||||
|
|
||||||
See also: [clearContent()](#)
|
See also: [clearContent](/api/commands/clear-content)
|
||||||
|
|
||||||
## Parameters
|
## Parameters
|
||||||
|
|
||||||
@@ -20,6 +20,23 @@ Options to configure the parsing can be passed during initialization and/or with
|
|||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
```js
|
```js
|
||||||
this.editor.commands.setContent('<p>Example Content</p>')
|
// HTML
|
||||||
|
this.editor.commands.setContent('<p>Example Text</p>')
|
||||||
|
|
||||||
|
// JSON
|
||||||
|
this.editor.commands.setContent({
|
||||||
|
"type": "doc",
|
||||||
|
"content": [
|
||||||
|
{
|
||||||
|
"type": "paragraph",
|
||||||
|
"content": [
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"text": "Example Text"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -133,9 +133,20 @@
|
|||||||
- title: Commands
|
- title: Commands
|
||||||
link: /api/commands
|
link: /api/commands
|
||||||
items:
|
items:
|
||||||
|
- title: clearContent
|
||||||
|
link: /api/commands/clear-content
|
||||||
|
type: draft
|
||||||
|
- title: insertHTML
|
||||||
|
link: /api/commands/insert-html
|
||||||
|
type: draft
|
||||||
|
- title: insertNode
|
||||||
|
link: /api/commands/insert-node
|
||||||
|
type: draft
|
||||||
|
- title: insertText
|
||||||
|
link: /api/commands/insert-text
|
||||||
|
type: draft
|
||||||
- title: setContent
|
- title: setContent
|
||||||
link: /api/commands/set-content
|
link: /api/commands/set-content
|
||||||
type: draft
|
|
||||||
- title: Nodes
|
- title: Nodes
|
||||||
link: /api/nodes
|
link: /api/nodes
|
||||||
items:
|
items:
|
||||||
|
|||||||
Reference in New Issue
Block a user