docs: update content
This commit is contained in:
@@ -6,13 +6,11 @@ Keep in mind that the editor will enforce the configured schema, and the documen
|
|||||||
See also: [setContent](/api/commands/set-content), [insertContent](/api/commands/insert-content)
|
See also: [setContent](/api/commands/set-content), [insertContent](/api/commands/insert-content)
|
||||||
|
|
||||||
## Parameters
|
## Parameters
|
||||||
|
|
||||||
`emitUpdate: Boolean (false)`
|
`emitUpdate: Boolean (false)`
|
||||||
|
|
||||||
By default, it doesn’t trigger the update event. Passing `true` doesn’t prevent triggering the update event.
|
By default, it doesn’t trigger the update event. Passing `true` doesn’t prevent triggering the update event.
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
```js
|
```js
|
||||||
// Remoe all content from the document
|
// Remoe all content from the document
|
||||||
this.editor.commands.clearContent()
|
this.editor.commands.clearContent()
|
||||||
|
|||||||
8
docs/src/docPages/api/commands/clear-nodes.md
Normal file
8
docs/src/docPages/api/commands/clear-nodes.md
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
# clearNodes
|
||||||
|
The `clearNodes` command normalizes nodes to a simple paragraph, it even normalizes all kind of lists. For advanced use cases it can come in handy, before applying a new node type.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
```js
|
||||||
|
this.editor.commands.clearNodes()
|
||||||
|
```
|
||||||
|
|
||||||
@@ -4,7 +4,6 @@ The `insertContent` command adds a passed value to the document.
|
|||||||
See also: [setContent](/api/commands/set-content), [clearContent](/api/commands/clear-content)
|
See also: [setContent](/api/commands/set-content), [clearContent](/api/commands/clear-content)
|
||||||
|
|
||||||
## Parameters
|
## Parameters
|
||||||
|
|
||||||
`value: Content`
|
`value: Content`
|
||||||
|
|
||||||
The command is pretty flexible and takes plain text, HTML or even JSON as a value.
|
The command is pretty flexible and takes plain text, HTML or even JSON as a value.
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ The `setContent` command replaces the document with a new one. You can pass JSON
|
|||||||
See also: [insertContent](/api/commands/insert-content), [clearContent](/api/commands/clear-content)
|
See also: [insertContent](/api/commands/insert-content), [clearContent](/api/commands/clear-content)
|
||||||
|
|
||||||
## Parameters
|
## Parameters
|
||||||
|
|
||||||
`content: string`
|
`content: string`
|
||||||
|
|
||||||
Pass a string (JSON or HTML) as [content](/guide/output). The editor will only render what’s allowed according to the [schema](/api/schema).
|
Pass a string (JSON or HTML) as [content](/guide/output). The editor will only render what’s allowed according to the [schema](/api/schema).
|
||||||
@@ -18,7 +17,6 @@ By default, it doesn’t trigger the update event. Passing `true` doesn’t prev
|
|||||||
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).
|
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
|
## Usage
|
||||||
|
|
||||||
```js
|
```js
|
||||||
// HTML
|
// HTML
|
||||||
this.editor.commands.setContent('<p>Example Text</p>')
|
this.editor.commands.setContent('<p>Example Text</p>')
|
||||||
|
|||||||
22
docs/src/docPages/api/commands/update-attributes.md
Normal file
22
docs/src/docPages/api/commands/update-attributes.md
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
# updateAttributes
|
||||||
|
The `updateAttributes` command sets attributes of a node or mark to new values. Not passed attributes won’t be touched.
|
||||||
|
|
||||||
|
## Parameters
|
||||||
|
|
||||||
|
`typeOrName: string | NodeType | MarkType`
|
||||||
|
|
||||||
|
Pass the type you want to update, for example `'heading'`.
|
||||||
|
|
||||||
|
`attributes: AnyObject`
|
||||||
|
|
||||||
|
This expects an object with the attributes that need to be updated. It doesn’t need to have all attributes.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
```js
|
||||||
|
// Update node attributes
|
||||||
|
this.editor.commands.updateAttributes('heading', { level: 1 })
|
||||||
|
|
||||||
|
// Update mark attributes
|
||||||
|
this.editor.commands.updateAttributes('highlight', { color: 'pink' })
|
||||||
|
```
|
||||||
|
|
||||||
@@ -139,6 +139,11 @@
|
|||||||
link: /api/commands/insert-content
|
link: /api/commands/insert-content
|
||||||
- title: setContent
|
- title: setContent
|
||||||
link: /api/commands/set-content
|
link: /api/commands/set-content
|
||||||
|
|
||||||
|
- title: clearNodes
|
||||||
|
link: /api/commands/clear-nodes
|
||||||
|
- title: updateAtttributes
|
||||||
|
link: /api/commands/update-attributes
|
||||||
- title: Nodes
|
- title: Nodes
|
||||||
link: /api/nodes
|
link: /api/nodes
|
||||||
items:
|
items:
|
||||||
|
|||||||
Reference in New Issue
Block a user