diff --git a/docs/api/commands/create-paragraph-near.md b/docs/api/commands/create-paragraph-near.md index 95836c32..8a0805cf 100644 --- a/docs/api/commands/create-paragraph-near.md +++ b/docs/api/commands/create-paragraph-near.md @@ -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() +``` diff --git a/docs/api/commands/delete-node.md b/docs/api/commands/delete-node.md index b2940dfc..40e17486 100644 --- a/docs/api/commands/delete-node.md +++ b/docs/api/commands/delete-node.md @@ -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) +``` diff --git a/docs/api/commands/delete-range.md b/docs/api/commands/delete-range.md index 13d4e272..aa44b9dd 100644 --- a/docs/api/commands/delete-range.md +++ b/docs/api/commands/delete-range.md @@ -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 }) +``` diff --git a/docs/api/commands/delete-selection.md b/docs/api/commands/delete-selection.md index cd63ad52..e0a67ccb 100644 --- a/docs/api/commands/delete-selection.md +++ b/docs/api/commands/delete-selection.md @@ -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() +``` diff --git a/docs/api/commands/enter.md b/docs/api/commands/enter.md index dc4f3d42..f7e7020b 100644 --- a/docs/api/commands/enter.md +++ b/docs/api/commands/enter.md @@ -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() +``` diff --git a/docs/api/commands/exit-code.md b/docs/api/commands/exit-code.md index 5c2cf7e0..1c47d3e4 100644 --- a/docs/api/commands/exit-code.md +++ b/docs/api/commands/exit-code.md @@ -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() +``` diff --git a/docs/api/commands/insert-content-at.md b/docs/api/commands/insert-content-at.md index 73bc4930..b69a3b97 100644 --- a/docs/api/commands/insert-content-at.md +++ b/docs/api/commands/insert-content-at.md @@ -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` + +* 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, '

Hello world

', { + updateSelection: true, + parseOptions: { + preserveWhitespace: 'full', + } +}) +``` diff --git a/docs/api/commands/join-backward.md b/docs/api/commands/join-backward.md index 2a4a2a90..4c2a1aa5 100644 --- a/docs/api/commands/join-backward.md +++ b/docs/api/commands/join-backward.md @@ -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() +``` diff --git a/docs/api/commands/join-forward.md b/docs/api/commands/join-forward.md index 7913b1f4..c0438593 100644 --- a/docs/api/commands/join-forward.md +++ b/docs/api/commands/join-forward.md @@ -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 diff --git a/docs/api/commands/keyboard-shortcut.md b/docs/api/commands/keyboard-shortcut.md index 614a5400..f8a43cd7 100644 --- a/docs/api/commands/keyboard-shortcut.md +++ b/docs/api/commands/keyboard-shortcut.md @@ -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') +``` diff --git a/docs/api/commands/lift-empty-block.md b/docs/api/commands/lift-empty-block.md index 8badb39a..7d773d9e 100644 --- a/docs/api/commands/lift-empty-block.md +++ b/docs/api/commands/lift-empty-block.md @@ -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() +``` diff --git a/docs/api/commands/lift-list-item.md b/docs/api/commands/lift-list-item.md index cce9b551..4a71132e 100644 --- a/docs/api/commands/lift-list-item.md +++ b/docs/api/commands/lift-list-item.md @@ -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() +``` diff --git a/docs/api/commands/lift.md b/docs/api/commands/lift.md index cd7d0512..ad58265f 100644 --- a/docs/api/commands/lift.md +++ b/docs/api/commands/lift.md @@ -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` + +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 }) +``` diff --git a/docs/api/commands/newline-in-code.md b/docs/api/commands/newline-in-code.md index 9fb035b1..2b34e9bb 100644 --- a/docs/api/commands/newline-in-code.md +++ b/docs/api/commands/newline-in-code.md @@ -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() +``` diff --git a/docs/api/commands/reset-attributes.md b/docs/api/commands/reset-attributes.md index 18613310..edb35508 100644 --- a/docs/api/commands/reset-attributes.md +++ b/docs/api/commands/reset-attributes.md @@ -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']) +``` diff --git a/docs/api/commands/scroll-into-view.md b/docs/api/commands/scroll-into-view.md index 78fe78fd..79a2652a 100644 --- a/docs/api/commands/scroll-into-view.md +++ b/docs/api/commands/scroll-into-view.md @@ -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() +``` diff --git a/docs/api/commands/select-node-backward.md b/docs/api/commands/select-node-backward.md index 51fda13d..7240451b 100644 --- a/docs/api/commands/select-node-backward.md +++ b/docs/api/commands/select-node-backward.md @@ -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() +``` diff --git a/docs/api/commands/select-node-forward.md b/docs/api/commands/select-node-forward.md index 98f2ca6b..32f5614a 100644 --- a/docs/api/commands/select-node-forward.md +++ b/docs/api/commands/select-node-forward.md @@ -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() +``` diff --git a/docs/api/commands/select-parent-node.md b/docs/api/commands/select-parent-node.md index 97248027..84c9c394 100644 --- a/docs/api/commands/select-parent-node.md +++ b/docs/api/commands/select-parent-node.md @@ -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() +``` diff --git a/docs/api/commands/select-textblock-end.md b/docs/api/commands/select-textblock-end.md index f27799b1..b396c155 100644 --- a/docs/api/commands/select-textblock-end.md +++ b/docs/api/commands/select-textblock-end.md @@ -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() +``` diff --git a/docs/api/commands/select-textblock-start.md b/docs/api/commands/select-textblock-start.md index 5e99588a..4c7cd2c6 100644 --- a/docs/api/commands/select-textblock-start.md +++ b/docs/api/commands/select-textblock-start.md @@ -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() +``` diff --git a/docs/api/commands/set-mark.md b/docs/api/commands/set-mark.md index 0421f318..4dec9ed1 100644 --- a/docs/api/commands/set-mark.md +++ b/docs/api/commands/set-mark.md @@ -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` + +The attributes that should be applied to the mark. **This is optional.** + +## Usage +```js +editor.commands.setMark("bold", { class: 'bold-tag' }) +``` diff --git a/docs/api/commands/set-node-selection.md b/docs/api/commands/set-node-selection.md index 7d6dbca9..2232d3ac 100644 --- a/docs/api/commands/set-node-selection.md +++ b/docs/api/commands/set-node-selection.md @@ -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) +``` diff --git a/docs/api/commands/set-node.md b/docs/api/commands/set-node.md index 30a415b5..ebdac9af 100644 --- a/docs/api/commands/set-node.md +++ b/docs/api/commands/set-node.md @@ -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` + +The attributes that should be applied to the node. **This is optional.** + +## Usage +```js +editor.commands.setNode("paragraph", { id: "paragraph-01" }) +``` diff --git a/docs/api/commands/sink-list-item.md b/docs/api/commands/sink-list-item.md index 842a3bc5..c4b0afc8 100644 --- a/docs/api/commands/sink-list-item.md +++ b/docs/api/commands/sink-list-item.md @@ -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() +``` diff --git a/docs/api/commands/split-block.md b/docs/api/commands/split-block.md index 7e4f7b6c..ef816d44 100644 --- a/docs/api/commands/split-block.md +++ b/docs/api/commands/split-block.md @@ -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` + +* `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 }) +``` diff --git a/docs/api/commands/split-list-item.md b/docs/api/commands/split-list-item.md index 4ce444df..7e100798 100644 --- a/docs/api/commands/split-list-item.md +++ b/docs/api/commands/split-list-item.md @@ -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') +``` diff --git a/docs/api/commands/toggle-list.md b/docs/api/commands/toggle-list.md index 78e5ecd6..6b77285a 100644 --- a/docs/api/commands/toggle-list.md +++ b/docs/api/commands/toggle-list.md @@ -1,5 +1,20 @@ # toggleList +`toggleList` will toggle between different types of lists. -:::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 +`listTypeOrName: string | NodeType` + +The type of node that should be used for the wrapping list + +`itemTypeOrName: string | NodeType` + +The type of node that should be used for the list items + +## Usage +```js +// toggle a bullet list with list items +editor.commands.toggleList('bullet_list', 'list_item') + +// toggle a numbered list with list items +editor.commands.toggleList('ordered_list', 'list_item') +``` diff --git a/docs/api/commands/toggle-mark.md b/docs/api/commands/toggle-mark.md index 0b6ee229..23eb49b3 100644 --- a/docs/api/commands/toggle-mark.md +++ b/docs/api/commands/toggle-mark.md @@ -1,5 +1,26 @@ # toggleMark +The `toggleMark` command toggles a specific mark on and off 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 mark that should be toggled. + +`attributes?: Record` + +The attributes that should be applied to the mark. **This is optional.** + +`options?: Record` +* `extendEmptyMarkRange: boolean` - Removes the mark even across the current selection. Defaults to `false` + +## Usage +```js +// toggles a bold mark +editor.commands.toggleMark('bold') + +// toggles bold mark with a color attribute +editor.commands.toggleMark('bold', { color: 'red' }) + +// toggles a bold mark with a color attribute and removes the mark across the current selection +editor.commands.toggleMark('bold', { color: 'red' }, { extendEmptyMarkRange: true }) +``` diff --git a/docs/api/commands/toggle-node.md b/docs/api/commands/toggle-node.md index 210cfb78..15c3ea1e 100644 --- a/docs/api/commands/toggle-node.md +++ b/docs/api/commands/toggle-node.md @@ -1,5 +1,24 @@ # toggleNode +`toggleNode` will a node with another 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) -::: +## Parameters +`typeOrName: string | NodeType` + +The type of node that should be toggled. + +`toggleTypeOrName: string | NodeType` + +The type of node that should be used for the toggling. + +`attributes?: Record` + +The attributes that should be applied to the node. **This is optional.** + +## Usage +```js +// toggle a paragraph with a heading node +editor.commands.toggleNode('paragraph', 'heading', { level: 1 }) + +// toggle a paragraph with a image node +editor.commands.toggleNode('paragraph', 'image', { src: 'https://example.com/image.png' }) +``` diff --git a/docs/api/commands/toggle-wrap.md b/docs/api/commands/toggle-wrap.md index aada62c1..f2d81231 100644 --- a/docs/api/commands/toggle-wrap.md +++ b/docs/api/commands/toggle-wrap.md @@ -1,5 +1,17 @@ # toggleWrap +`toggleWrap` wraps the current node with a new node or removes a wrapping 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) -::: +## Parameters +`typeOrName: string | NodeType` + +The type of node that should be used for the wrapping node. + +`attributes?: Record` + +The attributes that should be applied to the node. **This is optional.** + +## Usage +```js +// toggle wrap the current selection with a heading node +editor.commands.toggleWrap('heading', { level: 1 }) +``` diff --git a/docs/api/commands/undo-input-rule.md b/docs/api/commands/undo-input-rule.md index 693c9ebe..9512f1ae 100644 --- a/docs/api/commands/undo-input-rule.md +++ b/docs/api/commands/undo-input-rule.md @@ -1,5 +1,7 @@ # undoInputRule +`undoInputRule` will undo the most recent input rule that was triggered. -:::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.undoInputRule() +``` diff --git a/docs/api/commands/unset-all-marks.md b/docs/api/commands/unset-all-marks.md index 5c713290..eb5666e2 100644 --- a/docs/api/commands/unset-all-marks.md +++ b/docs/api/commands/unset-all-marks.md @@ -1,5 +1,7 @@ # unsetAllMarks +`unsetAllMarks` will remove all marks from 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.unsetAllMarks() +``` diff --git a/docs/api/commands/unset-mark.md b/docs/api/commands/unset-mark.md index ab527be4..f0600a48 100644 --- a/docs/api/commands/unset-mark.md +++ b/docs/api/commands/unset-mark.md @@ -1,5 +1,20 @@ # unsetMark +`unsetMark` will remove the mark from the current selection. Can also remove all marks across 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 mark that should be removed. + +`options?: Record` + +* `extendEmptyMarkRange?: boolean` - Removes the mark even across the current selection. Defaults to `false` + +## Usage +```js +// removes a bold mark +editor.commands.unsetMark('bold') + +// removes a bold mark across the current selection +editor.commands.unsetMark('bold', { extendEmptyMarkRange: true }) +``` diff --git a/docs/api/commands/wrap-in-list.md b/docs/api/commands/wrap-in-list.md index ea6a1866..11d7c8f9 100644 --- a/docs/api/commands/wrap-in-list.md +++ b/docs/api/commands/wrap-in-list.md @@ -1,5 +1,17 @@ # wrapInList +`wrapInList` will wrap a node in the current selection in a 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) -::: +## Parameters +`typeOrName: string | NodeType` + +The type of node that should be wrapped in a list. + +`attributes?: Record` + +The attributes that should be applied to the list. **This is optional.** + +## Usage +```js +// wrap a paragraph in a bullet list +editor.commands.wrapInList('paragraph') +``` diff --git a/docs/links.yaml b/docs/links.yaml index 2c026d15..235543a8 100644 --- a/docs/links.yaml +++ b/docs/links.yaml @@ -158,22 +158,16 @@ link: /api/commands/clear-nodes - title: createParagraphNear link: /api/commands/create-paragraph-near - type: draft - title: deleteNode link: /api/commands/delete-node - type: draft - title: deleteRange link: /api/commands/delete-range - type: draft - title: deleteSelection link: /api/commands/delete-selection - type: draft - title: enter link: /api/commands/enter - type: draft - title: exitCode link: /api/commands/exit-code - type: draft - title: extendMarkRange link: /api/commands/extend-mark-range - title: focus @@ -184,101 +178,72 @@ link: /api/commands/insert-content - title: insertContentAt link: /api/commands/insert-content-at - type: draft - title: joinBackward link: /api/commands/join-backward - type: draft - title: joinForward link: /api/commands/join-forward - type: draft - title: keyboardShortcut link: /api/commands/keyboard-shortcut - type: draft - title: liftEmptyBlock link: /api/commands/lift-empty-block - type: draft - title: liftListItem link: /api/commands/lift-list-item - type: draft - title: lift link: /api/commands/lift - type: draft - title: newlineInCode link: /api/commands/newline-in-code - type: draft - title: resetAttributes link: /api/commands/reset-attributes - type: draft - title: scrollIntoView link: /api/commands/scroll-into-view - type: draft - title: selectAll link: /api/commands/select-all - title: selectNodeBackward link: /api/commands/select-node-backward - type: draft - title: selectNodeForward link: /api/commands/select-node-forward - type: draft - title: selectParentNode link: /api/commands/select-parent-node - type: draft - title: selectTextblockEnd link: /api/commands/select-textblock-end - type: draft - title: selectTextblockStart link: /api/commands/select-textblock-start - type: draft - title: setContent link: /api/commands/set-content - title: setMark link: /api/commands/set-mark - type: draft - title: setMeta link: /api/commands/set-meta - title: setNode link: /api/commands/set-node - type: draft - title: setNodeSelection link: /api/commands/set-node-selection - type: draft - title: setTextSelection link: /api/commands/set-text-selection - title: sinkListItem link: /api/commands/sink-list-item - type: draft - title: splitBlock link: /api/commands/split-block - type: draft - title: splitListItem link: /api/commands/split-list-item - type: draft - title: toggleList link: /api/commands/toggle-list - type: draft - title: toggleMark link: /api/commands/toggle-mark - type: draft - title: toggleNode link: /api/commands/toggle-node - type: draft - title: toggleWrap link: /api/commands/toggle-wrap - type: draft - title: undoInputRule link: /api/commands/undo-input-rule - type: draft - title: unsetAllMarks link: /api/commands/unset-all-marks - type: draft - title: unsetMark link: /api/commands/unset-mark - type: draft - title: updateAttributes link: /api/commands/update-attributes - title: wrapInList link: /api/commands/wrap-in-list - type: draft - title: Nodes link: /api/nodes items: