diff --git a/docs/src/docPages/api/commands.md b/docs/src/docPages/api/commands.md index bfe76122..0fd3564e 100644 --- a/docs/src/docPages/api/commands.md +++ b/docs/src/docPages/api/commands.md @@ -1,65 +1,35 @@ # Commands -:::warning Out of date -This content is written for tiptap 1 and needs an update. -::: +## Chain commands -- menus -- buttons -- commands +```js +editor.chain().focus().bold().run() +``` -## .clearContent() +## List of commands -Clear the whole document. +### Content +| Command | Description | +| --------------- | ----------------------------------------------------------- | +| .clearContent() | Clear the whole document. | +| .insertHTML() | Insert a string of HTML at the currently selected position. | +| .insertText() | Insert a string of text at the currently selected position. | +| .setContent() | Replace the whole document with new content. | -## .deleteSelection() +### Nodes & Marks +| Command | Description | +| ------------------- | ------------------------------------------ | +| .removeMark() | Remove a mark in the current selection. | +| .removeMarks() | Remove all marks in the current selection. | +| .replaceWithNode() | Replace a given range with a node. | +| .selectParentNode() | Select the parent node. | +| .toggleMark() | Toggle a mark on and off. | +| .toggleNode() | Toggle a node with another node. | +| .updateMark() | Update a mark with new attributes. | -Delete the selection, if there is one. - -## .focus() - -Focus the editor at the given position. - -## .insertHTML() - -Insert a string of HTML at the currently selected position. - -## .insertText() - -Insert a string of text at the currently selected position. - -## .removeMark() - -Remove a mark in the current selection. - -## .removeMarks() - -Remove all marks in the current selection. - -## .replaceWithNode() - -Replace a given range with a node. - -## .selectAll() - -Select the whole document. - -## .selectParentNode() - -Select the parent node. - -## .setContent() - -Replace the whole document with new content. - -## .toggleMark() - -Toggle a mark on and off. - -## .toggleNode() - -Toggle a node with another node. - -## .updateMark() - -Update a mark with new attributes. \ No newline at end of file +### Selection +| Command | Description | +| ------------------ | --------------------------------------- | +| .deleteSelection() | Delete the selection, if there is one. | +| .focus() | Focus the editor at the given position. | +| .selectAll() | Select the whole document. | diff --git a/docs/src/docPages/api/overview.md b/docs/src/docPages/api/overview.md new file mode 100644 index 00000000..d985b94c --- /dev/null +++ b/docs/src/docPages/api/overview.md @@ -0,0 +1,15 @@ +# Overview + +* tiptap is a friendly wrapped around ProseMirror. +* ProseMirror works with a strict [Schema](/api/schema), which defines the allowed structure of a document. +* A document is a tree of headings, paragraphs and others elements, so called nodes. +* Marks can be attached to a node, e. g. to emphasize part of it. +* [Commands](/api/commands) change that document programmatically. +* The document is stored in a state. +* All changes are applied as transactions to the state. +* The state has details about the current content, cursor position and selection. +* You can hook into a few different [events](/api/events), for example to alter transactions before they get applied. +* [Extensions](/api/extensions) add functionality like nodes, marks and/or commands to the editor. +* A huge amount of commands are bound to common [keyboard shortcuts](/api/keyboard-shortcuts). + +All of those concepts are explained in detail on the following pages. diff --git a/docs/src/links.yaml b/docs/src/links.yaml index a783be6b..5faf9e2f 100644 --- a/docs/src/links.yaml +++ b/docs/src/links.yaml @@ -105,10 +105,12 @@ - title: API items: + - title: Overview + link: /api/overview - title: Editor - link: /api/editor/ + link: /api/editor - title: Extensions - link: /api/extensions/ + link: /api/extensions items: - title: Blockquote link: /api/extensions/blockquote @@ -176,7 +178,6 @@ link: /api/extensions/underline - title: Commands link: /api/commands - draft: true - title: Events link: /api/events - title: Schema