docs: update content
This commit is contained in:
@@ -148,13 +148,13 @@ commands.first([
|
||||
Have a look at all of the core commands listed below. They should give you a good first impression of what’s possible.
|
||||
|
||||
### Content
|
||||
| Command | Description |
|
||||
| --------------- | ------------------------------------------------ |
|
||||
| .clearContent() | Clear the whole document. |
|
||||
| .insertHTML() | Insert a string of HTML at the current position. |
|
||||
| .insertNode() | Insert a node at the current position. |
|
||||
| .insertText() | Insert a string of text at the current position. |
|
||||
| .setContent() | Replace the whole document with new content. |
|
||||
| Command | Description | Links |
|
||||
| --------------- | ------------------------------------------------ | ----------------------------------- |
|
||||
| .clearContent() | Clear the whole document. | [More](/api/commands/clear-content) |
|
||||
| .insertHTML() | Insert a string of HTML at the current position. | |
|
||||
| .insertNode() | Insert a node at the current position. | |
|
||||
| .insertText() | Insert a string of text at the current position. | |
|
||||
| .setContent() | Replace the whole document with new content. | |
|
||||
|
||||
### Nodes & Marks
|
||||
| Command | Description |
|
||||
@@ -249,5 +249,5 @@ addCommands() {
|
||||
## Add custom commands
|
||||
All extensions can add additional commands (and most do), check out the specific [documentation for the provided nodes](/api/nodes), [marks](/api/marks), and [extensions](/api/extensions) to learn more about those.
|
||||
|
||||
Of course, you can [add your custom extensions](/guide/build-extensions) with custom commands aswell.
|
||||
Of course, you can [add your custom extensions](/guide/custom-extensions) with custom commands aswell.
|
||||
|
||||
|
||||
25
docs/src/docPages/api/commands/set-content.md
Normal file
25
docs/src/docPages/api/commands/set-content.md
Normal 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. It’s 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 what’s allowed according to the [schema](/api/schema).
|
||||
|
||||
`emitUpdate?: Boolean`
|
||||
|
||||
By default, it doesn’t trigger the update event. Passing `true` doesn’t 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>')
|
||||
```
|
||||
|
||||
@@ -129,7 +129,7 @@ new Editor({
|
||||
| `null` | Disables autofocus. |
|
||||
|
||||
### Enable input rules
|
||||
By default, tiptap enables all [input rules](/guide/build-extensions/#input-rules). With `enableInputRules` you can disable that.
|
||||
By default, tiptap enables all [input rules](/guide/custom-extensions/#input-rules). With `enableInputRules` you can disable that.
|
||||
|
||||
```js
|
||||
import { Editor } from '@tiptap/core'
|
||||
@@ -143,7 +143,7 @@ new Editor({
|
||||
```
|
||||
|
||||
### Enable paste rules
|
||||
By default, tiptap enables all [paste rules](/guide/build-extensions/#paste-rules). With `enablePasteRules` you can disable that.
|
||||
By default, tiptap enables all [paste rules](/guide/custom-extensions/#paste-rules). With `enablePasteRules` you can disable that.
|
||||
|
||||
```js
|
||||
import { Editor } from '@tiptap/core'
|
||||
|
||||
@@ -51,4 +51,4 @@ const editor = new Editor({
|
||||
],
|
||||
```
|
||||
|
||||
Learn [more about custom extensions in our guide](/guide/build-extensions).
|
||||
Learn [more about custom extensions in our guide](/guide/custom-extensions).
|
||||
|
||||
@@ -7,7 +7,7 @@ Unlike many other editors, tiptap is based on a [schema](https://prosemirror.net
|
||||
|
||||
This schema is *very* strict. You can’t use any HTML element or attribute that is not defined in your schema.
|
||||
|
||||
Let me give you one example: If you paste something like `This is <strong>important</strong>` into tiptap, don’t have any extension that handles `strong` tags registered, you’ll only see `This is important` – without the strong tags.
|
||||
Let me give you one example: If you paste something like `This is <strong>important</strong>` into tiptap, but don’t have any extension that handles `strong` tags, you’ll only see `This is important` – without the strong tags.
|
||||
|
||||
## How a schema looks like
|
||||
When you’ll work with the provided extensions only, you don’t have to care that much about the schema. If you’re building your own extensions, it’s probably helpful to understand how the schema works. Let’s look at the most simple schema for a typical ProseMirror editor:
|
||||
|
||||
Reference in New Issue
Block a user