docs: update content
This commit is contained in:
@@ -13,9 +13,9 @@ By default, it doesn’t trigger the update event. Passing `true` doesn’t prev
|
||||
## Usage
|
||||
```js
|
||||
// Remoe all content from the document
|
||||
this.editor.commands.clearContent()
|
||||
editor.commands.clearContent()
|
||||
|
||||
// Remove all content, and trigger the `update` event
|
||||
this.editor.commands.clearContent(true)
|
||||
editor.commands.clearContent(true)
|
||||
```
|
||||
|
||||
|
||||
@@ -3,6 +3,6 @@ The `clearNodes` command normalizes nodes to a simple paragraph, it even normali
|
||||
|
||||
## Usage
|
||||
```js
|
||||
this.editor.commands.clearNodes()
|
||||
editor.commands.clearNodes()
|
||||
```
|
||||
|
||||
|
||||
@@ -11,13 +11,13 @@ The command is pretty flexible and takes plain text, HTML or even JSON as a valu
|
||||
## Usage
|
||||
```js
|
||||
// Plain text
|
||||
this.editor.commands.insertContent('Example Text')
|
||||
editor.commands.insertContent('Example Text')
|
||||
|
||||
// HTML
|
||||
this.editor.commands.insertContent('<h1>Example Text</h1>')
|
||||
editor.commands.insertContent('<h1>Example Text</h1>')
|
||||
|
||||
// JSON/Nodes
|
||||
this.editor.commands.insertContent({
|
||||
editor.commands.insertContent({
|
||||
type: 'heading',
|
||||
attrs: {
|
||||
level: 1,
|
||||
|
||||
@@ -19,10 +19,10 @@ Options to configure the parsing can be passed during initialization and/or with
|
||||
## Usage
|
||||
```js
|
||||
// HTML
|
||||
this.editor.commands.setContent('<p>Example Text</p>')
|
||||
editor.commands.setContent('<p>Example Text</p>')
|
||||
|
||||
// JSON
|
||||
this.editor.commands.setContent({
|
||||
editor.commands.setContent({
|
||||
"type": "doc",
|
||||
"content": [
|
||||
{
|
||||
|
||||
@@ -14,9 +14,9 @@ This expects an object with the attributes that need to be updated. It doesn’t
|
||||
## Usage
|
||||
```js
|
||||
// Update node attributes
|
||||
this.editor.commands.updateAttributes('heading', { level: 1 })
|
||||
editor.commands.updateAttributes('heading', { level: 1 })
|
||||
|
||||
// Update mark attributes
|
||||
this.editor.commands.updateAttributes('highlight', { color: 'pink' })
|
||||
editor.commands.updateAttributes('highlight', { color: 'pink' })
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user