docs: update content, add new commands pages

This commit is contained in:
Hans Pagel
2021-04-06 23:57:20 +02:00
parent 85556fc428
commit 2c5a82df47
7 changed files with 85 additions and 7 deletions

View File

@@ -1,7 +1,7 @@
# setContent
The `setContent` command replaces the document with a new one. You can pass JSON or HTML, both work fine. Its basically the same as setting the `content` on initialization.
See also: [clearContent()](#)
See also: [clearContent](/api/commands/clear-content)
## Parameters
@@ -20,6 +20,23 @@ Options to configure the parsing can be passed during initialization and/or with
## Usage
```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"
}
]
}
]
})
```