From 303b069348c36e40a776ef6cb45f12684700707b Mon Sep 17 00:00:00 2001 From: Hans Pagel Date: Sat, 26 Sep 2020 13:57:47 +0200 Subject: [PATCH] improve the editor page --- docs/src/docPages/api/editor.md | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/docs/src/docPages/api/editor.md b/docs/src/docPages/api/editor.md index cd95dc2e..b30e2c23 100644 --- a/docs/src/docPages/api/editor.md +++ b/docs/src/docPages/api/editor.md @@ -2,8 +2,6 @@ This class is a central building block of tiptap. It does most of the heavy lifting of creating a working [ProseMirror](https://ProseMirror.net/) editor such as creating the [`EditorView`](https://ProseMirror.net/docs/ref/#view.EditorView), setting the initial [`EditorState`](https://ProseMirror.net/docs/ref/#state.Editor_State) and so on. ## Configuration -All of the listed settings can be set before initialization, or read during runtime, or some of them even updated for a running instance (e. g. `editable`). - | Setting | Type | Default | Description | | ------------------ | --------------- | ----------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `autoFocus` | `Boolean` | `false` | Focus the editor on init. | @@ -19,3 +17,22 @@ All of the listed settings can be set before initialization, or read during runt | `onFocus` | `Function` | `undefined` | Returns an object with the `event` and current `state` and `view` of Prosemirror on focus. | | `onInit` | `Function` | `undefined` | Returns an object with the current `state` and `view` of Prosemirror on init. | | `onUpdate` | `Function` | `undefined` | Returns an object with the current `state` of Prosemirror, a `json()` and `html()` function and the `transaction` on every change. | + +## Methods +| Method | Parameters | Description | +| -------------------- | ----------------------------------------------------------------------------------------------------------- | --------------------------------------------------------- | +| `html()` | – | Returns the current content as HTML. | +| `json()` | – | Returns the current content as JSON. | +| `destroy()` | – | Stops the editor instance and unbinds all events. | +| `chain()` | - | Create a command chain to call multiple commands at once. | +| `setOptions()` | `options` A list of options | Update editor options. | +| `isEditable()` | - | Returns whether the editor is editable. | +| `state()` | - | Returns the editor state. | +| `registerCommands()` | `commands` A list of commands | Register a list of commands. | +| `registerCommand()` | `name` The name of your command
`callback` The method of your command | Register a command. | +| `registerPlugin()` | `plugin` A ProseMirror plugin
`handlePlugins` Control how to merge the plugin into the existing plugins. | Register a ProseMirror plugin. | +| `unregisterPlugin()` | `name` The plugins name | Unregister a ProseMirror plugin. | +| `createDocument()` | `content` EditorContent
`parseOptions` | Creates a ProseMirror document. | +| `getNodeAttrs()` | `name` Name of the node | Get attributes of the currently selected node. | +| `getMarkAttrs()` | `name` Name of the mark | Get attributes of the currently selected mark. | +| `isActive()` | `name` Name of the node or mark
`attrs` Attributes of the node or mark | Returns if the currently selected node or mark is active. |