mirror of
https://github.com/ueberdosis/tiptap.git
synced 2024-11-24 19:59:02 +08:00
docs: update content
This commit is contained in:
parent
b5cf0892c4
commit
e597ed9f55
@ -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)
|
||||
|
||||
## Parameters
|
||||
|
||||
`emitUpdate: Boolean (false)`
|
||||
|
||||
By default, it doesn’t trigger the update event. Passing `true` doesn’t prevent triggering the update event.
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
// Remoe all content from the document
|
||||
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)
|
||||
|
||||
## Parameters
|
||||
|
||||
`value: Content`
|
||||
|
||||
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)
|
||||
|
||||
## Parameters
|
||||
|
||||
`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).
|
||||
@ -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).
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
// HTML
|
||||
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
|
||||
- title: setContent
|
||||
link: /api/commands/set-content
|
||||
|
||||
- title: clearNodes
|
||||
link: /api/commands/clear-nodes
|
||||
- title: updateAtttributes
|
||||
link: /api/commands/update-attributes
|
||||
- title: Nodes
|
||||
link: /api/nodes
|
||||
items:
|
||||
|
Loading…
Reference in New Issue
Block a user