docs: update content

This commit is contained in:
Hans Pagel
2021-04-06 23:36:07 +02:00
parent cc21f8bb70
commit 3f3ce1d8d4
17 changed files with 62 additions and 33 deletions

View File

@@ -0,0 +1,25 @@
# 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()](#)
## Parameters
`content: string`
Pass a string (JSON or HTML) as [content](/guide/output). The editor will only render whats allowed according to the [schema](/api/schema).
`emitUpdate?: Boolean`
By default, it doesnt trigger the update event. Passing `true` doesnt prevent triggering the update event.
`parseOptions?: AnyObject`
Options to configure the parsing can be passed during initialization and/or with setContent. Read more about parseOptions in the [ProseMirror documentation](https://prosemirror.net/docs/ref/#model.ParseOptions).
## Usage
```js
this.editor.commands.setContent('<p>Example Content</p>')
```