Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(docs): add missing documentation for commands #2861

Merged
merged 4 commits into from
Jun 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions docs/api/commands/create-paragraph-near.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# createParagraphNear
If a block node is currently selected, the `createParagraphNear` command creates an empty paragraph after the currently selected block node. If the selected block node is the first child of its parent, the new paragraph will be inserted before the current selection.

:::warning
Oops, we didn’t find time to fill this page. Writing documentation needs attention to detail, a great understanding of the project and time to write. Though Tiptap is used by thousands of developers all around the world, it’s still a side project for us. Let’s change that and make open source our full-time job! [Become a sponsor!](https://github.com/sponsors/ueberdosis)
:::
## Usage
```js
editor.commands.createParagraphNear()
```
17 changes: 14 additions & 3 deletions docs/api/commands/delete-node.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# deleteNode
The `deleteNode` command deletes a node inside the current selection. It requires a `typeOrName` argument, which can be a string or a `NodeType` to find the node that needs to be deleted. After deleting the node, the view will automatically scroll to the cursors position.

:::warning
Oops, we didn’t find time to fill this page. Writing documentation needs attention to detail, a great understanding of the project and time to write. Though Tiptap is used by thousands of developers all around the world, it’s still a side project for us. Let’s change that and make open source our full-time job! [Become a sponsor!](https://github.com/sponsors/ueberdosis)
:::
## Parameters
`typeOrName: string | NodeType`

## Usage
```js
// deletes a paragraph node
editor.commands.deleteNode('paragraph')

// or

// deletes a custom node
editor.commands.deleteNode(MyCustomNode)
```
11 changes: 8 additions & 3 deletions docs/api/commands/delete-range.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# deleteRange
The `deleteRange` command deletes everything in a given range. It requires a `range` attribute of type `Range`.

:::warning
Oops, we didn’t find time to fill this page. Writing documentation needs attention to detail, a great understanding of the project and time to write. Though Tiptap is used by thousands of developers all around the world, it’s still a side project for us. Let’s change that and make open source our full-time job! [Become a sponsor!](https://github.com/sponsors/ueberdosis)
:::
## Parameters
`range: Range`

## Usage
```js
editor.commands.deleteRange({ from: 0, to: 12 })
```
8 changes: 5 additions & 3 deletions docs/api/commands/delete-selection.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# deleteSelection
The `deleteSelection` command deletes the currently selected nodes. If no selection exists, nothing will be deleted.

:::warning
Oops, we didn’t find time to fill this page. Writing documentation needs attention to detail, a great understanding of the project and time to write. Though Tiptap is used by thousands of developers all around the world, it’s still a side project for us. Let’s change that and make open source our full-time job! [Become a sponsor!](https://github.com/sponsors/ueberdosis)
:::
## Usage
```js
editor.commands.deleteSelection()
```
8 changes: 5 additions & 3 deletions docs/api/commands/enter.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# enter
The `enter` command triggers an enter programmatically.

:::warning
Oops, we didn’t find time to fill this page. Writing documentation needs attention to detail, a great understanding of the project and time to write. Though Tiptap is used by thousands of developers all around the world, it’s still a side project for us. Let’s change that and make open source our full-time job! [Become a sponsor!](https://github.com/sponsors/ueberdosis)
:::
## Usage
```js
editor.commands.enter()
```
8 changes: 5 additions & 3 deletions docs/api/commands/exit-code.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# exitCode
The `exitCode` command will create a default block after the current selection if the selection is a `code` element and move the cursor to the new block.

:::warning
Oops, we didn’t find time to fill this page. Writing documentation needs attention to detail, a great understanding of the project and time to write. Though Tiptap is used by thousands of developers all around the world, it’s still a side project for us. Let’s change that and make open source our full-time job! [Become a sponsor!](https://github.com/sponsors/ueberdosis)
:::
## Usage
```js
editor.commands.exitCode()
```
27 changes: 24 additions & 3 deletions docs/api/commands/insert-content-at.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,26 @@
# insertContentAt
The `insertContentAt` will insert a string of html or a node at a given position or range. If a range is given, the new content will replace the content in the given range with the new content.

:::warning
Oops, we didn’t find time to fill this page. Writing documentation needs attention to detail, a great understanding of the project and time to write. Though Tiptap is used by thousands of developers all around the world, it’s still a side project for us. Let’s change that and make open source our full-time job! [Become a sponsor!](https://github.com/sponsors/ueberdosis)
:::
## Parameters
`position: number | Range`

The position or range the content will be inserted in.

`value: Content`

The content to be inserted. Can be a string of HTML or a node.

`options: Record<string, any>`

* updateSelection: controls if the selection should be moved to the newly inserted content.
* parseOptions: Passed content is parsed by ProseMirror. To hook into the parsing, you can pass `parseOptions` which are then handled by [ProseMirror](https://prosemirror.net/docs/ref/#model.ParseOptions).

## Usage
```js
editor.commands.insertContentAt(12, '<p>Hello world</p>', {
updateSelection: true,
parseOptions: {
preserveWhitespace: 'full',
}
})
```
8 changes: 5 additions & 3 deletions docs/api/commands/join-backward.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# joinBackward
The `joinBackward` command joins two nodes backwards from the current selection. If the selection is empty and at the start of a textblock, `joinBackward` will try to reduce the distance between that block and the block before it. [See also](https://prosemirror.net/docs/ref/#commands.joinBackward)

:::warning
Oops, we didn’t find time to fill this page. Writing documentation needs attention to detail, a great understanding of the project and time to write. Though Tiptap is used by thousands of developers all around the world, it’s still a side project for us. Let’s change that and make open source our full-time job! [Become a sponsor!](https://github.com/sponsors/ueberdosis)
:::
## Usage
```js
editor.commands.joinBackward()
```
9 changes: 5 additions & 4 deletions docs/api/commands/join-forward.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# joinForward
The `joinForward` command joins two nodes forwards from the current selection. If the selection is empty and at the end of a textblock, `joinForward` will try to reduce the distance between that block and the block after it. [See also](https://prosemirror.net/docs/ref/#commands.joinForward)

:::warning
Oops, we didn’t find time to fill this page. Writing documentation needs attention to detail, a great understanding of the project and time to write. Though Tiptap is used by thousands of developers all around the world, it’s still a side project for us. Let’s change that and make open source our full-time job! [Become a sponsor!](https://github.com/sponsors/ueberdosis)
:::
## Usage
```js
editor.commands.joinForward()
```

https://prosemirror.net/docs/ref/#commands.joinForward
13 changes: 10 additions & 3 deletions docs/api/commands/keyboard-shortcut.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# keyboardShortcut
The `keyboardShortcut` command will try to trigger a ShortcutEvent with a given name.

:::warning
Oops, we didn’t find time to fill this page. Writing documentation needs attention to detail, a great understanding of the project and time to write. Though Tiptap is used by thousands of developers all around the world, it’s still a side project for us. Let’s change that and make open source our full-time job! [Become a sponsor!](https://github.com/sponsors/ueberdosis)
:::
## Parameters
`name: String`

The name of the shortcut to trigger.

## Usage
```js
editor.commands.keyboardShortcut('undo')
```
8 changes: 5 additions & 3 deletions docs/api/commands/lift-empty-block.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# liftEmptyBlock
If the currently selected block is an empty textblock, lift it if possible. **Lifting** means, that the block will be moved to the parent of the block it is currently in.

:::warning
Oops, we didn’t find time to fill this page. Writing documentation needs attention to detail, a great understanding of the project and time to write. Though Tiptap is used by thousands of developers all around the world, it’s still a side project for us. Let’s change that and make open source our full-time job! [Become a sponsor!](https://github.com/sponsors/ueberdosis)
:::
## Usage
```js
editor.commands.liftEmptyBlock()
```
8 changes: 5 additions & 3 deletions docs/api/commands/lift-list-item.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# liftListItem
The `liftListItem` will try to lift the list item around the current selection up into a wrapping parent list.

:::warning
Oops, we didn’t find time to fill this page. Writing documentation needs attention to detail, a great understanding of the project and time to write. Though Tiptap is used by thousands of developers all around the world, it’s still a side project for us. Let’s change that and make open source our full-time job! [Become a sponsor!](https://github.com/sponsors/ueberdosis)
:::
## Usage
```js
editor.commands.liftListItem()
```
21 changes: 18 additions & 3 deletions docs/api/commands/lift.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# lift
The `lift` command lifts a given node up into it's parent node. **Lifting** means, that the block will be moved to the parent of the block it is currently in.

:::warning
Oops, we didn’t find time to fill this page. Writing documentation needs attention to detail, a great understanding of the project and time to write. Though Tiptap is used by thousands of developers all around the world, it’s still a side project for us. Let’s change that and make open source our full-time job! [Become a sponsor!](https://github.com/sponsors/ueberdosis)
:::
## Parameters
`typeOrName: String | NodeType`

The node that should be lifted. If the node is not found in the current selection, ignore the command.

`attributes: Record<string, any>`

The attributes the node should have to be lifted. This is **optional**.

## Usage
```js
// lift any headline
editor.commands.lift('headline')

// lift only h2
editor.commands.lift('headline', { level: 2 })
```
8 changes: 5 additions & 3 deletions docs/api/commands/newline-in-code.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# newlineInCode
`newlineInCode` inserts a new line in the current code block. If a selection is set, the selection will be replaced with a newline character.

:::warning
Oops, we didn’t find time to fill this page. Writing documentation needs attention to detail, a great understanding of the project and time to write. Though Tiptap is used by thousands of developers all around the world, it’s still a side project for us. Let’s change that and make open source our full-time job! [Become a sponsor!](https://github.com/sponsors/ueberdosis)
:::
## Usage
```js
editor.commands.newlineInCode()
```
18 changes: 15 additions & 3 deletions docs/api/commands/reset-attributes.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# resetAttributes
`resetAttributes` resets some of the nodes attributes back to it's default attributes.

:::warning
Oops, we didn’t find time to fill this page. Writing documentation needs attention to detail, a great understanding of the project and time to write. Though Tiptap is used by thousands of developers all around the world, it’s still a side project for us. Let’s change that and make open source our full-time job! [Become a sponsor!](https://github.com/sponsors/ueberdosis)
:::
## Parameters
`typeOrName: string | Node`

The node that should be resetted. Can be a string or a Node.

`attributes: string | string[]`

A string or an array of strings that defines which attributes should be reset.

## Usage
```js
// reset the style and class attributes on the currently selected paragraph nodes
editor.commands.resetAttributes('paragraph', ['style', 'class'])
```
8 changes: 5 additions & 3 deletions docs/api/commands/scroll-into-view.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# scrollIntoView
`scrollIntoView` scrolls the view to the current selection or cursor position.

:::warning
Oops, we didn’t find time to fill this page. Writing documentation needs attention to detail, a great understanding of the project and time to write. Though Tiptap is used by thousands of developers all around the world, it’s still a side project for us. Let’s change that and make open source our full-time job! [Become a sponsor!](https://github.com/sponsors/ueberdosis)
:::
## Usage
```js
editor.commands.scrollIntoView()
```
8 changes: 5 additions & 3 deletions docs/api/commands/select-node-backward.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# selectNodeBackward
If the selection is empty and at the start of a textblock, `selectNodeBackward` will select the node before the current textblock if possible.

:::warning
Oops, we didn’t find time to fill this page. Writing documentation needs attention to detail, a great understanding of the project and time to write. Though Tiptap is used by thousands of developers all around the world, it’s still a side project for us. Let’s change that and make open source our full-time job! [Become a sponsor!](https://github.com/sponsors/ueberdosis)
:::
## Usage
```js
editor.commands.selectNodeBackward()
```
8 changes: 5 additions & 3 deletions docs/api/commands/select-node-forward.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# selectNodeForward
If the selection is empty and at the end of a textblock, `selectNodeForward` will select the node after the current textblock if possible.

:::warning
Oops, we didn’t find time to fill this page. Writing documentation needs attention to detail, a great understanding of the project and time to write. Though Tiptap is used by thousands of developers all around the world, it’s still a side project for us. Let’s change that and make open source our full-time job! [Become a sponsor!](https://github.com/sponsors/ueberdosis)
:::
## Usage
```js
editor.commands.selectNodeForward()
```
8 changes: 5 additions & 3 deletions docs/api/commands/select-parent-node.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# selectParentNode
`selectParentNode` will try to get the parent node of the currently selected node and move the selection to that node.

:::warning
Oops, we didn’t find time to fill this page. Writing documentation needs attention to detail, a great understanding of the project and time to write. Though Tiptap is used by thousands of developers all around the world, it’s still a side project for us. Let’s change that and make open source our full-time job! [Become a sponsor!](https://github.com/sponsors/ueberdosis)
:::
## Usage
```js
editor.commands.selectParentNode()
```
8 changes: 5 additions & 3 deletions docs/api/commands/select-textblock-end.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# selectTextblockEnd
The `selectTextblockEnd` will move the cursor to the end of the current textblock if the block is a valid textblock.

:::warning
Oops, we didn’t find time to fill this page. Writing documentation needs attention to detail, a great understanding of the project and time to write. Though Tiptap is used by thousands of developers all around the world, it’s still a side project for us. Let’s change that and make open source our full-time job! [Become a sponsor!](https://github.com/sponsors/ueberdosis)
:::
## Usage
```js
editor.commands.selectTextblockEnd()
```
8 changes: 5 additions & 3 deletions docs/api/commands/select-textblock-start.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# selectTextblockStart
The `selectTextblockStart` will move the cursor to the start of the current textblock if the block is a valid textblock.

:::warning
Oops, we didn’t find time to fill this page. Writing documentation needs attention to detail, a great understanding of the project and time to write. Though Tiptap is used by thousands of developers all around the world, it’s still a side project for us. Let’s change that and make open source our full-time job! [Become a sponsor!](https://github.com/sponsors/ueberdosis)
:::
## Usage
```js
editor.commands.selectTextblockStart()
```
18 changes: 15 additions & 3 deletions docs/api/commands/set-mark.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# setMark
The `setMark` command will add a new mark at the current selection.

:::warning
Oops, we didn’t find time to fill this page. Writing documentation needs attention to detail, a great understanding of the project and time to write. Though Tiptap is used by thousands of developers all around the world, it’s still a side project for us. Let’s change that and make open source our full-time job! [Become a sponsor!](https://github.com/sponsors/ueberdosis)
:::
## Parameters

`typeOrName: string | MarkType`

The type of a mark to add. Can be a string or a MarkType.

`attributes: Record<string, any>`

The attributes that should be applied to the mark. **This is optional.**

## Usage
```js
editor.commands.setMark("bold", { class: 'bold-tag' })
```
13 changes: 10 additions & 3 deletions docs/api/commands/set-node-selection.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# setNodeSelection
`setNodeSelection` creates a new NodeSelection at a given position. A node selection is a selection that points to a single node. [See more](https://prosemirror.net/docs/ref/#state.NodeSelection)

:::warning
Oops, we didn’t find time to fill this page. Writing documentation needs attention to detail, a great understanding of the project and time to write. Though Tiptap is used by thousands of developers all around the world, it’s still a side project for us. Let’s change that and make open source our full-time job! [Become a sponsor!](https://github.com/sponsors/ueberdosis)
:::
## Parameters
`position: number`

The position the NodeSelection will be created at.

## Usage
```js
editor.commands.setNodeSelection(10)
```
18 changes: 15 additions & 3 deletions docs/api/commands/set-node.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# setNode
The `setNode` command will replace a given range with a given node. The range depends on the current selection. **Important**: Currently `setNode` only supports text block nodes.

:::warning
Oops, we didn’t find time to fill this page. Writing documentation needs attention to detail, a great understanding of the project and time to write. Though Tiptap is used by thousands of developers all around the world, it’s still a side project for us. Let’s change that and make open source our full-time job! [Become a sponsor!](https://github.com/sponsors/ueberdosis)
:::
## Parameters

`typeOrName: string | NodeType`

The type of the node that will replace the range. Can be a string or a NodeType.

`attributes?: Record<string, any>`

The attributes that should be applied to the node. **This is optional.**

## Usage
```js
editor.commands.setNode("paragraph", { id: "paragraph-01" })
```
8 changes: 5 additions & 3 deletions docs/api/commands/sink-list-item.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# sinkListItem
The `sinkListItem` will try to sink the list item around the current selection down into a wrapping child list.

:::warning
Oops, we didn’t find time to fill this page. Writing documentation needs attention to detail, a great understanding of the project and time to write. Though Tiptap is used by thousands of developers all around the world, it’s still a side project for us. Let’s change that and make open source our full-time job! [Become a sponsor!](https://github.com/sponsors/ueberdosis)
:::
## Usage
```js
editor.commands.liftListItem()
```
17 changes: 14 additions & 3 deletions docs/api/commands/split-block.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# splitBlock
`splitBlock` will split the current node into two nodes at the current [NodeSelection](https://prosemirror.net/docs/ref/#state.NodeSelection). If the current selection is not splittable, the command will be ignored.

:::warning
Oops, we didn’t find time to fill this page. Writing documentation needs attention to detail, a great understanding of the project and time to write. Though Tiptap is used by thousands of developers all around the world, it’s still a side project for us. Let’s change that and make open source our full-time job! [Become a sponsor!](https://github.com/sponsors/ueberdosis)
:::
## Parameters
`options: Record<string, any>`

* `keepMarks: boolean` - Defines if the marks should be kept or removed. Defaults to `true`.

## Usage
```js
// split the current node and keep marks
editor.commands.splitBlock()

// split the current node and don't keep marks
editor.commands.splitBlock({ keepMarks: false })
```
13 changes: 10 additions & 3 deletions docs/api/commands/split-list-item.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# splitListItem
`splitListItem` splits one list item into two separate list items. If this is a nested list, the wrapping list item should be split.

:::warning
Oops, we didn’t find time to fill this page. Writing documentation needs attention to detail, a great understanding of the project and time to write. Though Tiptap is used by thousands of developers all around the world, it’s still a side project for us. Let’s change that and make open source our full-time job! [Become a sponsor!](https://github.com/sponsors/ueberdosis)
:::
## Parameters
`typeOrName: string | NodeType`

The type of node that should be split into two separate list items.

## Usage
```js
editor.commands.splitListItem('bullet_list')
```
Loading