diff --git a/docs/src/docPages/extensions.md b/docs/src/docPages/extensions.md index 3dd290d4e..ed4d9847d 100644 --- a/docs/src/docPages/extensions.md +++ b/docs/src/docPages/extensions.md @@ -1 +1,917 @@ -# Extensions \ No newline at end of file +# Extensions + +> ⚠️ TODO: This is old content. + +By default, the editor will only support paragraphs. Other nodes and marks are available as **extensions**. You must +install `tiptap-extensions` package separately so that you can use basic Nodes, Marks, or Plugins. An extension is +usually tied to a [Command](../commands/basics.md). The official set of commands are part of the +[`tiptap-commands`][@npmjs-tiptap-commands] package. + +## Blockquote +Allows you to use the `
` HTML tag in the editor. + +#### Options +*None* + +#### Commands +| command | options | description | +| ------ | ---- | ---------------- | +| blockquote | none | Wrap content in a blockquote. | + +#### Keybindings +`Ctrl->` + +#### Example +```vue + +++ + + +``` + +## Bold +Renders text in **bold** text weight. If you pass ``, or `` tags, or text with inline `style` attributes setting the `font-weight` CSS rule in the editor's initial content, they will be rendered accordingly. + +::: warning Restrictions +The extension will generate the corresponding `` HTML tags when reading contents of the `Editor` instance. All text marked as bold, regardless of method will be normalized to `` HTML tags. +::: + +#### Options +*None* + +#### Commands +| command | options | description | +| ------ | ---- | ---------------- | +| bold | none | Mark text as bold. | + +#### Keybindings +`Ctrl-b` (on Windows/Linux) +`Cmd-b` (on macOS) + +#### Example + +```vue + ++ + + ++ ++ + + +``` + +## BulletList +Allows you to use the `+ + + ++ ` HTML tag in the editor. + +::: warning Restrictions +This extensions is intended to be used with the `ListItem` extension. +::: + +#### Options +*None* + +#### Commands +| command | options | description | +| ------ | ---- | ---------------- | +| bullet_list | none | Toggle a bullet list. | + +#### Keybindings +`Shift-Ctrl-8` + +#### Example + +```vue + +
++ + + +``` + +## Code +Allows you to use the `+ + + ++ ` HTML tag in the editor. + +#### Options +*None* + +#### Commands +| command | options | description | +| ------ | ---- | ---------------- | +| code | none | Mark text as code. | + +#### Keybindings +`Mod-`` + +#### Example +```vue + +
++ + + +``` + +## CodeBlock +Allows you to use the `+ + + ++ ` HTML tag in the editor. + +## CodeBlockHighlight +Allows you to use the `` HTML tag with auto-detected syntax highlighting in the editor. + +## Collaboration +Allows you to collaborate with others on one document. + +## HardBreak +Allows you to use the `
` HTML tag in the editor. + +#### Options +*None* + +#### Keybindings +`Mod-Enter`, `Shift-Enter` + +## Heading +Allows you to use the headline HTML tags in the editor. + +#### Options +| option | type | default | description | +| ------ | ---- | ---- | ----- | +| levels | Array | [1, 2, 3, 4, 5, 6] | Specifies which headlines are to be supported. | + +#### Commands +| command | options | description | +| ------ | ---- | ---------------- | +| heading | level | Creates a heading node. | + +#### Keybindings +`Shift-Ctrl-1` → H1 +`Shift-Ctrl-2` → H2 +`Shift-Ctrl-3` → H3 +`Shift-Ctrl-4` → H4 +`Shift-Ctrl-5` → H5 +`Shift-Ctrl-6` → H6 + +#### Example +```vue + +++ + + +``` + +## History +Enables history support. + +#### Commands +| command | options | description | +| ------ | ---- | ---------------- | +| undo | none | Undo the latest change. | +| redo | none | Redo the latest change. | + +#### Keybindings +`Mod-z` → Undo +`Shift-Mod-z` → Redo + +#### Example +```vue + ++ + ++ + +++ ++ + + +``` + +## HorizontalRule +Allows you to use the `+ + ++ + +++
` HTML tag in the editor. + +#### Options +*None* + +#### Commands +| command | options | description | +| ------ | ---- | ---------------- | +| horizontal_rule | none | Create a horizontal rule. | + +#### Keybindings +*None* + +#### Example +```vue + +++ + + +``` + +## Italic +Allows you to use the `` HTML tag in the editor. + +#### Options +*None* + +#### Commands +| command | options | description | +| ------ | ---- | ---------------- | +| italic | none | Mark text as italic. | + +#### Keybindings +`Ctrl-i` (on Windows/Linux) +`Cmd-i` (on macOS) + +#### Example +```vue + ++ + + ++ ++ + + +``` + +## Link +Allows you to use the `` HTML tag in the editor. +#### Options +| option | type | default | description | +| ------ | ---- | ---- | ----- | +| openOnClick | Boolean | true | Specifies if links will be opened on click. | + +## ListItem +Allows you to use the `+ + + ++ - ` HTML tag in the editor. + +::: warning Restrictions +This extensions is intended to be used with the `BulletList` or `OrderedList` extension. +::: + +## Mention +Allows you to use mentions in the editor. + +## OrderedList +Allows you to use the `
` HTML tag in the editor. + +::: warning Restrictions +This extensions is intended to be used with the `ListItem` extension. +::: + +#### Options +*None* + +#### Commands +| command | options | description | +| ------ | ---- | ---------------- | +| ordered_list | none | Toggle an ordered list. | + +#### Keybindings +`Shift-Ctrl-9` + +#### Example +```vue + +
++ + + +``` + +## Placeholder +Allows you to show placeholders on empty paragraphs. + +## Table +This enables support for tables in your editor. +Tables can be nested and allow all blocks to be used inside. +Each `+ + + ++ ` includes a single ` `. + +#### Options +| option | type | default | description | +| ------ | ---- | ---- | ----- | +| resizable | Boolean | false | Enables the resizing of columns | + +#### Keybindings +`Tab` → Next Cell +`Shift-Tab` → Previous Cell + +#### Commands +| command | options | description | +| ------ | ---- | ---------------- | +| createTable | ```{ rowsCount, colsCount, withHeaderRow }``` | Returns a table node of a given size. `withHeaderRow` defines whether the first row of the table will be a header row. | +| deleteTable | none | Deletes the complete table which is active | +| addColumnBefore | none | Add a column before the selection. | +| addColumnAfter | none | Add a column after the selection. | +| deleteColumn | none | Removes the selected columns. | +| addRowBefore | none | Add a table row before the selection. | +| addRowAfter | none | Add a table row after the selection. | +| toggleCellMerge | none | See mergeCells and splitCells | +| mergeCells | none | Merge the selected cells into a single cell. Only available when the selected cells' outline forms a rectangle. | +| splitCell | none | Split a selected cell, whose rowspan or colspan is greater than one into smaller cells. | +| toggleHeaderColumn | none | Toggles whether the selected column contains header cells. | +| toggleHeaderRow | none | Toggles whether the selected row contains header cells. | +| toggleHeaderCell | none | Toggles whether the selected column contains header cells. | +| setCellAttr | none | Returns a command that sets the given attribute to the given value, and is only available when the currently selected cell doesn't already have that attribute set to that value. | +| fixTables | none | Inspect all tables in the given state's document and return a transaction that fixes them, if necessary. | + +#### Example +::: warning +You have to include all table extensions (`TableHeader`, `TableCell` & `TableRow`) +::: + +```vue + + ++ + + +``` + +## TableHeader +Allows you to use the `+ + + ++ ` HTML tag in the editor. + +::: warning Restrictions +This extensions is intended to be used with the `Table` extension. +::: + +## TableCell +Allows you to use the ` ` HTML tag in the editor. + +::: warning Restrictions +This extensions is intended to be used with the `Table` extension. +::: + +## TableRow +Allows you to use the ` ` HTML tag in the editor. + +::: warning Restrictions +This extensions is intended to be used with the `Table` extension. +::: + +## TodoItem +It renders a single toggleable item of a list. + +::: warning Restrictions +This extensions is intended to be used with the `TodoList` extension. +::: + +#### Options +| option | type | default | description | +| ------ | ---- | ---- | ----- | +| nested | Boolean | false | Specifies if you can nest todo lists. | + +#### Commands +*None* + +#### Keybindings +*None* + +## TodoList +Renders a toggleable list of items. + +::: warning Restrictions +This extensions is intended to be used with the `TodoItem` extension. +::: + +#### Options +*None* + +#### Commands +| command | options | description | +| ------ | ---- | ---------------- | +| todo_list | none | Toggle todo list. | + +#### Keybindings +*None* + +#### Example +```vue + + ++ + + +``` + +## Strike +Allows you to use the `+ + + ++ ` HTML tag in the editor. + +#### Options +*None* + +#### Commands +| command | options | description | +| ------ | ---- | ---------------- | +| strike | none | Mark text as strikethrough. | + +#### Keybindings +`Ctrl-d` (on Windows/Linux) +`Cmd-d` (on macOS) + +#### Example + +```vue + +++ + + +``` + +## Underline +Allows you to use the `` HTML tag in the editor. + +#### Options +*None* + +#### Commands +| command | options | description | +| ------ | ---- | ---------------- | +| underline | none | Mark text as underlined. | + +#### Keybindings +`Ctrl-u` (on Windows/Linux) +`Cmd-u` (on macOS) + +#### Example + +```vue + ++ + + ++ ++ + + +``` + +[@tiptap-contrib]: https://github.com/ueberdosis/tiptap/blob/master/CONTRIBUTING.md +[@npmjs-tiptap-commands]: https://npmjs.org/package/tiptap-commands+ + + ++