remove gridsome
This commit is contained in:
11
docs/api/commands/blur.md
Normal file
11
docs/api/commands/blur.md
Normal file
@@ -0,0 +1,11 @@
|
||||
# blur
|
||||
This command removes the focus from the editor.
|
||||
|
||||
See also: [focus](/api/commands/focus)
|
||||
|
||||
## Usage
|
||||
```js
|
||||
// Remove the focus from the editor
|
||||
editor.commands.blur()
|
||||
```
|
||||
|
||||
21
docs/api/commands/clear-content.md
Normal file
21
docs/api/commands/clear-content.md
Normal file
@@ -0,0 +1,21 @@
|
||||
# clearContent
|
||||
The `clearContent` command deletes the current document.
|
||||
|
||||
Keep in mind that the editor will enforce the configured schema, and the document won’t be `null`. The default [`Document`](/api/nodes/document) expects to have at least one block node, which is the paragraph by default. In other words: Even after running that command the document will have at least one (empty) paragraph.
|
||||
|
||||
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
|
||||
// Remove all content from the document
|
||||
editor.commands.clearContent()
|
||||
|
||||
// Remove all content, and trigger the `update` event
|
||||
editor.commands.clearContent(true)
|
||||
```
|
||||
|
||||
10
docs/api/commands/clear-nodes.md
Normal file
10
docs/api/commands/clear-nodes.md
Normal file
@@ -0,0 +1,10 @@
|
||||
# clearNodes
|
||||
The `clearNodes` command normalizes nodes to the default node, which is the paragraph by default. It’ll even normalize all kind of lists. For advanced use cases it can come in handy, before applying a new node type.
|
||||
|
||||
If you wonder how you can define the default node: It depends on what’s in the `content` attribute of your [`Document`](/api/nodes/document), by default that’s `block+` (at least one block node) and the [`Paragraph`](/api/nodes/paragraph) node has the highest priority, so it’s loaded first and is therefore the default node.
|
||||
|
||||
## Usage
|
||||
```js
|
||||
editor.commands.clearNodes()
|
||||
```
|
||||
|
||||
3
docs/api/commands/create-paragraph-near.md
Normal file
3
docs/api/commands/create-paragraph-near.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# createParagraphNear
|
||||
|
||||
<ContentMissing />
|
||||
3
docs/api/commands/delete-node.md
Normal file
3
docs/api/commands/delete-node.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# deleteNode
|
||||
|
||||
<ContentMissing />
|
||||
3
docs/api/commands/delete-range.md
Normal file
3
docs/api/commands/delete-range.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# deleteRange
|
||||
|
||||
<ContentMissing />
|
||||
3
docs/api/commands/delete-selection.md
Normal file
3
docs/api/commands/delete-selection.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# deleteSelection
|
||||
|
||||
<ContentMissing />
|
||||
3
docs/api/commands/enter.md
Normal file
3
docs/api/commands/enter.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# enter
|
||||
|
||||
<ContentMissing />
|
||||
3
docs/api/commands/exit-code.md
Normal file
3
docs/api/commands/exit-code.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# exitCode
|
||||
|
||||
<ContentMissing />
|
||||
29
docs/api/commands/extend-mark-range.md
Normal file
29
docs/api/commands/extend-mark-range.md
Normal file
@@ -0,0 +1,29 @@
|
||||
# extendMarkRange
|
||||
The `extendMarkRange` command expands the current selection to encompass the current mark. If the current selection doesn’t have the specified mark, nothing changes.
|
||||
|
||||
## Parameters
|
||||
`typeOrName: string | MarkType`
|
||||
|
||||
Name or type of the mark.
|
||||
|
||||
`attributes?: Record<string, any>`
|
||||
|
||||
Optionally, you can specify attributes that the extented mark must contain.
|
||||
|
||||
## Usage
|
||||
```js
|
||||
// Expand selection to link marks
|
||||
editor.commands.extendMarkRange('link')
|
||||
|
||||
// Expand selection to link marks with specific attributes
|
||||
editor.commands.extendMarkRange('link', { href: 'https://google.com' })
|
||||
|
||||
// Expand selection to link mark and update attributes
|
||||
editor
|
||||
.chain()
|
||||
.extendMarkRange('link')
|
||||
.updateAttributes('link', {
|
||||
href: 'https://duckduckgo.com'
|
||||
})
|
||||
.run()
|
||||
```
|
||||
26
docs/api/commands/focus.md
Normal file
26
docs/api/commands/focus.md
Normal file
@@ -0,0 +1,26 @@
|
||||
# focus
|
||||
This command sets the focus back to the editor.
|
||||
|
||||
When a user clicks on a button outside the editor, the browser sets the focus to that button. In most scenarios you want to focus the editor then again. That’s why you’ll see that in basically every demo here.
|
||||
|
||||
See also: [setTextSelection](/api/commands/set-text-selection), [blur](/api/commands/blur)
|
||||
|
||||
## Parameters
|
||||
`position: 'start' | 'end' | number | boolean | null (false)`
|
||||
|
||||
By default, it’s restoring the cursor position (and text selection). Pass a position to move the cursor too.
|
||||
|
||||
## Usage
|
||||
```js
|
||||
// Set the focus to the editor
|
||||
editor.commands.focus()
|
||||
|
||||
// Set the cursor to the first position
|
||||
editor.commands.focus('start')
|
||||
|
||||
// Set the cursor to the last position
|
||||
editor.commands.focus('end')
|
||||
|
||||
// Set the cursor to position 10
|
||||
editor.commands.focus(10)
|
||||
```
|
||||
20
docs/api/commands/for-each.md
Normal file
20
docs/api/commands/for-each.md
Normal file
@@ -0,0 +1,20 @@
|
||||
# forEach
|
||||
Loop through an array of items.
|
||||
|
||||
## Parameters
|
||||
`items: any[]`
|
||||
|
||||
An array of items.
|
||||
|
||||
`fn: (item: any, props: CommandProps & { index: number }) => boolean`
|
||||
|
||||
A function to do anything with your item.
|
||||
|
||||
## Usage
|
||||
```js
|
||||
const items = ['foo', 'bar', 'baz']
|
||||
|
||||
editor.commands.forEach(items, (item, { commands }) => {
|
||||
return commands.insertContent(item)
|
||||
})
|
||||
```
|
||||
3
docs/api/commands/insert-content-at.md
Normal file
3
docs/api/commands/insert-content-at.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# insertContentAt
|
||||
|
||||
<ContentMissing />
|
||||
63
docs/api/commands/insert-content.md
Normal file
63
docs/api/commands/insert-content.md
Normal file
@@ -0,0 +1,63 @@
|
||||
# insertContent
|
||||
The `insertContent` command adds the 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.
|
||||
|
||||
## Usage
|
||||
```js
|
||||
// Plain text
|
||||
editor.commands.insertContent('Example Text')
|
||||
|
||||
// HTML
|
||||
editor.commands.insertContent('<h1>Example Text</h1>')
|
||||
|
||||
// HTML with trim white space
|
||||
editor.commands.insertContent('<h1>Example Text</h1>',
|
||||
{
|
||||
parseOptions: {
|
||||
preserveWhitespace: false,
|
||||
}
|
||||
})
|
||||
|
||||
// JSON/Nodes
|
||||
editor.commands.insertContent({
|
||||
type: 'heading',
|
||||
attrs: {
|
||||
level: 1,
|
||||
},
|
||||
content: [
|
||||
{
|
||||
type: 'text',
|
||||
text: 'Example Text',
|
||||
},
|
||||
],
|
||||
})
|
||||
|
||||
// Multiple nodes at once
|
||||
editor.commands.insertContent([
|
||||
{
|
||||
type: 'paragraph',
|
||||
content: [
|
||||
{
|
||||
type: 'text',
|
||||
text: 'First paragraph',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
type: 'paragraph',
|
||||
content: [
|
||||
{
|
||||
type: 'text',
|
||||
text: 'Second paragraph',
|
||||
},
|
||||
],
|
||||
},
|
||||
])
|
||||
```
|
||||
|
||||
3
docs/api/commands/join-backward.md
Normal file
3
docs/api/commands/join-backward.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# joinBackward
|
||||
|
||||
<ContentMissing />
|
||||
5
docs/api/commands/join-forward.md
Normal file
5
docs/api/commands/join-forward.md
Normal file
@@ -0,0 +1,5 @@
|
||||
# joinForward
|
||||
|
||||
<ContentMissing />
|
||||
|
||||
https://prosemirror.net/docs/ref/#commands.joinForward
|
||||
3
docs/api/commands/keyboard-shortcut.md
Normal file
3
docs/api/commands/keyboard-shortcut.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# keyboardShortcut
|
||||
|
||||
<ContentMissing />
|
||||
3
docs/api/commands/lift-empty-block.md
Normal file
3
docs/api/commands/lift-empty-block.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# liftEmptyBlock
|
||||
|
||||
<ContentMissing />
|
||||
3
docs/api/commands/lift-list-item.md
Normal file
3
docs/api/commands/lift-list-item.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# liftListItem
|
||||
|
||||
<ContentMissing />
|
||||
3
docs/api/commands/lift.md
Normal file
3
docs/api/commands/lift.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# lift
|
||||
|
||||
<ContentMissing />
|
||||
3
docs/api/commands/newline-in-code.md
Normal file
3
docs/api/commands/newline-in-code.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# newlineInCode
|
||||
|
||||
<ContentMissing />
|
||||
3
docs/api/commands/reset-attributes.md
Normal file
3
docs/api/commands/reset-attributes.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# resetAttributes
|
||||
|
||||
<ContentMissing />
|
||||
3
docs/api/commands/scroll-into-view.md
Normal file
3
docs/api/commands/scroll-into-view.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# scrollIntoView
|
||||
|
||||
<ContentMissing />
|
||||
8
docs/api/commands/select-all.md
Normal file
8
docs/api/commands/select-all.md
Normal file
@@ -0,0 +1,8 @@
|
||||
# selectAll
|
||||
Selects the whole document at once.
|
||||
|
||||
## Usage
|
||||
```js
|
||||
// Select the whole document
|
||||
editor.commands.selectAll()
|
||||
```
|
||||
3
docs/api/commands/select-node-backward.md
Normal file
3
docs/api/commands/select-node-backward.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# selectNodeBackward
|
||||
|
||||
<ContentMissing />
|
||||
3
docs/api/commands/select-node-forward.md
Normal file
3
docs/api/commands/select-node-forward.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# selectNodeForward
|
||||
|
||||
<ContentMissing />
|
||||
3
docs/api/commands/select-parent-node.md
Normal file
3
docs/api/commands/select-parent-node.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# selectParentNode
|
||||
|
||||
<ContentMissing />
|
||||
40
docs/api/commands/set-content.md
Normal file
40
docs/api/commands/set-content.md
Normal file
@@ -0,0 +1,40 @@
|
||||
# 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: [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).
|
||||
|
||||
`emitUpdate?: Boolean (false)`
|
||||
|
||||
By default, it doesn’t trigger the update event. Passing `true` doesn’t prevent triggering the update event.
|
||||
|
||||
`parseOptions?: Record<string, any>`
|
||||
|
||||
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
|
||||
editor.commands.setContent('<p>Example Text</p>')
|
||||
|
||||
// JSON
|
||||
editor.commands.setContent({
|
||||
"type": "doc",
|
||||
"content": [
|
||||
{
|
||||
"type": "paragraph",
|
||||
"content": [
|
||||
{
|
||||
"type": "text",
|
||||
"text": "Example Text"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
})
|
||||
```
|
||||
|
||||
3
docs/api/commands/set-mark.md
Normal file
3
docs/api/commands/set-mark.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# setMark
|
||||
|
||||
<ContentMissing />
|
||||
21
docs/api/commands/set-meta.md
Normal file
21
docs/api/commands/set-meta.md
Normal file
@@ -0,0 +1,21 @@
|
||||
# setMeta
|
||||
Store a metadata property in the current transaction.
|
||||
|
||||
## Parameters
|
||||
`key: string`
|
||||
|
||||
The name of your metadata. You can get its value at any time with [getMeta](https://prosemirror.net/docs/ref/#state.Transaction.getMeta).
|
||||
|
||||
`value: any`
|
||||
|
||||
Store any value within your metadata.
|
||||
|
||||
## Usage
|
||||
```js
|
||||
// Prevent the update event from being triggered
|
||||
editor.commands.setMeta('preventUpdate', true)
|
||||
|
||||
// Store any value in the current transaction.
|
||||
// You can get this value at any time with tr.getMeta('foo').
|
||||
editor.commands.setMeta('foo', 'bar')
|
||||
```
|
||||
3
docs/api/commands/set-node-selection.md
Normal file
3
docs/api/commands/set-node-selection.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# setNodeSelection
|
||||
|
||||
<ContentMissing />
|
||||
3
docs/api/commands/set-node.md
Normal file
3
docs/api/commands/set-node.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# setNode
|
||||
|
||||
<ContentMissing />
|
||||
19
docs/api/commands/set-text-selection.md
Normal file
19
docs/api/commands/set-text-selection.md
Normal file
@@ -0,0 +1,19 @@
|
||||
# setTextSelection
|
||||
If you think of selection in the context of an editor, you’ll probably think of a text selection. With `setTextSelection` you can control that text selection and set it to a specified range or position.
|
||||
|
||||
See also: [focus](/api/commands/focus), [setNodeSelection](/api/commands/set-node-selection), [deleteSelection](/api/commands/delete-selection), [selectAll](/api/commands/select-all)
|
||||
|
||||
## Parameters
|
||||
`position: number | Range`
|
||||
|
||||
Pass a number, or a Range, for example `{ from: 5, to: 10 }`.
|
||||
|
||||
## Usage
|
||||
```js
|
||||
// Set the cursor to the specified position
|
||||
editor.commands.setTextSelection(10)
|
||||
|
||||
// Set the text selection to the specified range
|
||||
editor.commands.setTextSelection({ from: 5, to: 10 })
|
||||
```
|
||||
|
||||
3
docs/api/commands/sink-list-item.md
Normal file
3
docs/api/commands/sink-list-item.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# sinkListItem
|
||||
|
||||
<ContentMissing />
|
||||
3
docs/api/commands/split-block.md
Normal file
3
docs/api/commands/split-block.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# splitBlock
|
||||
|
||||
<ContentMissing />
|
||||
3
docs/api/commands/split-list-item.md
Normal file
3
docs/api/commands/split-list-item.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# splitListItem
|
||||
|
||||
<ContentMissing />
|
||||
3
docs/api/commands/toggle-list.md
Normal file
3
docs/api/commands/toggle-list.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# toggleList
|
||||
|
||||
<ContentMissing />
|
||||
3
docs/api/commands/toggle-mark.md
Normal file
3
docs/api/commands/toggle-mark.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# toggleMark
|
||||
|
||||
<ContentMissing />
|
||||
3
docs/api/commands/toggle-node.md
Normal file
3
docs/api/commands/toggle-node.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# toggleNode
|
||||
|
||||
<ContentMissing />
|
||||
3
docs/api/commands/toggle-wrap.md
Normal file
3
docs/api/commands/toggle-wrap.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# toggleWrap
|
||||
|
||||
<ContentMissing />
|
||||
3
docs/api/commands/undo-input-rule.md
Normal file
3
docs/api/commands/undo-input-rule.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# undoInputRule
|
||||
|
||||
<ContentMissing />
|
||||
3
docs/api/commands/unset-all-marks.md
Normal file
3
docs/api/commands/unset-all-marks.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# unsetAllMarks
|
||||
|
||||
<ContentMissing />
|
||||
3
docs/api/commands/unset-mark.md
Normal file
3
docs/api/commands/unset-mark.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# unsetMark
|
||||
|
||||
<ContentMissing />
|
||||
23
docs/api/commands/update-attributes.md
Normal file
23
docs/api/commands/update-attributes.md
Normal file
@@ -0,0 +1,23 @@
|
||||
# updateAttributes
|
||||
The `updateAttributes` command sets attributes of a node or mark to new values. Not passed attributes won’t be touched.
|
||||
|
||||
See also: [extendMarkRange](/api/commands/extend-mark-range)
|
||||
|
||||
## Parameters
|
||||
`typeOrName: string | NodeType | MarkType`
|
||||
|
||||
Pass the type you want to update, for example `'heading'`.
|
||||
|
||||
`attributes: Record<string, any>`
|
||||
|
||||
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
|
||||
editor.commands.updateAttributes('heading', { level: 1 })
|
||||
|
||||
// Update mark attributes
|
||||
editor.commands.updateAttributes('highlight', { color: 'pink' })
|
||||
```
|
||||
|
||||
3
docs/api/commands/wrap-in-list.md
Normal file
3
docs/api/commands/wrap-in-list.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# wrapInList
|
||||
|
||||
<ContentMissing />
|
||||
Reference in New Issue
Block a user