remove gridsome

This commit is contained in:
Philipp Kühn
2021-09-16 14:41:25 +02:00
parent e012a29240
commit 2f15a11572
311 changed files with 157 additions and 10308 deletions

11
docs/api/commands/blur.md Normal file
View 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()
```

View 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 wont 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 doesnt trigger the update event. Passing `true` doesnt 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)
```

View File

@@ -0,0 +1,10 @@
# clearNodes
The `clearNodes` command normalizes nodes to the default node, which is the paragraph by default. Itll 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 whats in the `content` attribute of your [`Document`](/api/nodes/document), by default thats `block+` (at least one block node) and the [`Paragraph`](/api/nodes/paragraph) node has the highest priority, so its loaded first and is therefore the default node.
## Usage
```js
editor.commands.clearNodes()
```

View File

@@ -0,0 +1,3 @@
# createParagraphNear
<ContentMissing />

View File

@@ -0,0 +1,3 @@
# deleteNode
<ContentMissing />

View File

@@ -0,0 +1,3 @@
# deleteRange
<ContentMissing />

View File

@@ -0,0 +1,3 @@
# deleteSelection
<ContentMissing />

View File

@@ -0,0 +1,3 @@
# enter
<ContentMissing />

View File

@@ -0,0 +1,3 @@
# exitCode
<ContentMissing />

View File

@@ -0,0 +1,29 @@
# extendMarkRange
The `extendMarkRange` command expands the current selection to encompass the current mark. If the current selection doesnt 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()
```

View 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. Thats why youll 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, its 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)
```

View 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)
})
```

View File

@@ -0,0 +1,3 @@
# insertContentAt
<ContentMissing />

View 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',
},
],
},
])
```

View File

@@ -0,0 +1,3 @@
# joinBackward
<ContentMissing />

View File

@@ -0,0 +1,5 @@
# joinForward
<ContentMissing />
https://prosemirror.net/docs/ref/#commands.joinForward

View File

@@ -0,0 +1,3 @@
# keyboardShortcut
<ContentMissing />

View File

@@ -0,0 +1,3 @@
# liftEmptyBlock
<ContentMissing />

View File

@@ -0,0 +1,3 @@
# liftListItem
<ContentMissing />

View File

@@ -0,0 +1,3 @@
# lift
<ContentMissing />

View File

@@ -0,0 +1,3 @@
# newlineInCode
<ContentMissing />

View File

@@ -0,0 +1,3 @@
# resetAttributes
<ContentMissing />

View File

@@ -0,0 +1,3 @@
# scrollIntoView
<ContentMissing />

View File

@@ -0,0 +1,8 @@
# selectAll
Selects the whole document at once.
## Usage
```js
// Select the whole document
editor.commands.selectAll()
```

View File

@@ -0,0 +1,3 @@
# selectNodeBackward
<ContentMissing />

View File

@@ -0,0 +1,3 @@
# selectNodeForward
<ContentMissing />

View File

@@ -0,0 +1,3 @@
# selectParentNode
<ContentMissing />

View 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. Its 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 whats allowed according to the [schema](/api/schema).
`emitUpdate?: Boolean (false)`
By default, it doesnt trigger the update event. Passing `true` doesnt 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"
}
]
}
]
})
```

View File

@@ -0,0 +1,3 @@
# setMark
<ContentMissing />

View 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')
```

View File

@@ -0,0 +1,3 @@
# setNodeSelection
<ContentMissing />

View File

@@ -0,0 +1,3 @@
# setNode
<ContentMissing />

View File

@@ -0,0 +1,19 @@
# setTextSelection
If you think of selection in the context of an editor, youll 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 })
```

View File

@@ -0,0 +1,3 @@
# sinkListItem
<ContentMissing />

View File

@@ -0,0 +1,3 @@
# splitBlock
<ContentMissing />

View File

@@ -0,0 +1,3 @@
# splitListItem
<ContentMissing />

View File

@@ -0,0 +1,3 @@
# toggleList
<ContentMissing />

View File

@@ -0,0 +1,3 @@
# toggleMark
<ContentMissing />

View File

@@ -0,0 +1,3 @@
# toggleNode
<ContentMissing />

View File

@@ -0,0 +1,3 @@
# toggleWrap
<ContentMissing />

View File

@@ -0,0 +1,3 @@
# undoInputRule
<ContentMissing />

View File

@@ -0,0 +1,3 @@
# unsetAllMarks
<ContentMissing />

View File

@@ -0,0 +1,3 @@
# unsetMark
<ContentMissing />

View File

@@ -0,0 +1,23 @@
# updateAttributes
The `updateAttributes` command sets attributes of a node or mark to new values. Not passed attributes wont 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 doesnt 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' })
```

View File

@@ -0,0 +1,3 @@
# wrapInList
<ContentMissing />