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
|
## Usage
|
||||||
```js
|
```js
|
||||||
// Remoe all content from the document
|
// Remoe all content from the document
|
||||||
this.editor.commands.clearContent()
|
editor.commands.clearContent()
|
||||||
|
|
||||||
// Remove all content, and trigger the `update` event
|
// 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
|
## Usage
|
||||||
```js
|
```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
|
## Usage
|
||||||
```js
|
```js
|
||||||
// Plain text
|
// Plain text
|
||||||
this.editor.commands.insertContent('Example Text')
|
editor.commands.insertContent('Example Text')
|
||||||
|
|
||||||
// HTML
|
// HTML
|
||||||
this.editor.commands.insertContent('<h1>Example Text</h1>')
|
editor.commands.insertContent('<h1>Example Text</h1>')
|
||||||
|
|
||||||
// JSON/Nodes
|
// JSON/Nodes
|
||||||
this.editor.commands.insertContent({
|
editor.commands.insertContent({
|
||||||
type: 'heading',
|
type: 'heading',
|
||||||
attrs: {
|
attrs: {
|
||||||
level: 1,
|
level: 1,
|
||||||
|
|||||||
@@ -19,10 +19,10 @@ Options to configure the parsing can be passed during initialization and/or with
|
|||||||
## Usage
|
## Usage
|
||||||
```js
|
```js
|
||||||
// HTML
|
// HTML
|
||||||
this.editor.commands.setContent('<p>Example Text</p>')
|
editor.commands.setContent('<p>Example Text</p>')
|
||||||
|
|
||||||
// JSON
|
// JSON
|
||||||
this.editor.commands.setContent({
|
editor.commands.setContent({
|
||||||
"type": "doc",
|
"type": "doc",
|
||||||
"content": [
|
"content": [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -14,9 +14,9 @@ This expects an object with the attributes that need to be updated. It doesn’t
|
|||||||
## Usage
|
## Usage
|
||||||
```js
|
```js
|
||||||
// Update node attributes
|
// Update node attributes
|
||||||
this.editor.commands.updateAttributes('heading', { level: 1 })
|
editor.commands.updateAttributes('heading', { level: 1 })
|
||||||
|
|
||||||
// Update mark attributes
|
// Update mark attributes
|
||||||
this.editor.commands.updateAttributes('highlight', { color: 'pink' })
|
editor.commands.updateAttributes('highlight', { color: 'pink' })
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user