From f41965f58c90ab7bd497e1bbfa9bce95fe17803b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20Ku=CC=88hn?= Date: Mon, 12 Nov 2018 22:49:54 +0100 Subject: [PATCH] update readme --- README.md | 272 +++++++++++++++++++++++++++++++----------------------- 1 file changed, 158 insertions(+), 114 deletions(-) diff --git a/README.md b/README.md index 1e1fd439..d3830007 100644 --- a/README.md +++ b/README.md @@ -32,27 +32,32 @@ yarn add tiptap ## Basic Setup ```vue ``` -## Editor Properties + -## Scoped Slots +## Components | **Name** | **Description** | | --- | --- | -| `editor` | Here the content will be rendered. | -| `menubar` | Here a menu bar will be rendered. | -| `menububble` | Here a menu bubble will be rendered. | +| `` | Here the content will be rendered. | +| `` | Here a menu bar will be rendered. | +| `` | Here a menu bubble will be rendered. | +| `` | Here a floating menu will be rendered. | -### Slot Properties +### EditorMenuBar -The `menubar` and `menububble` slot will receive some properties. +The `` component is renderless and will receive some properties through a scoped slot. | **Property** | **Type** | **Description** | | --- | :---: | --- | -| `nodes` | `Object` | A list of available nodes with active state and command. | -| `marks` | `Object` | A list of available marks with active state and command. | +| `commands` | `Array` | A list of all commands. | +| `isActive` | `Function` | A function to check if your selected text is a node or mark. `isActive({node|mark}, attrs)` | +| `markAttrs` | `Function` | A function to get all mark attributes of your selection. | | `focused` | `Boolean` | Whether the editor is focused. | | `focus` | `Function` | A function to focus the editor. | +#### Example + +```vue + +``` + +### EditorMenuBubble + +The `` component is renderless and will receive some properties through a scoped slot. + +| **Property** | **Type** | **Description** | +| --- | :---: | --- | +| `commands` | `Array` | A list of all commands. | +| `isActive` | `Function` | A function to check if your selected text is a node or mark. `isActive({node|mark}, attrs)` | +| `markAttrs` | `Function` | A function to get all mark attributes of your selection. | +| `focused` | `Boolean` | Whether the editor is focused. | +| `focus` | `Function` | A function to focus the editor. | +| `menu` | `Object` | An object for positioning your menu. | + +#### Example + +```vue + +``` + +### EditorFloatingMenu + +The `` component is renderless and will receive some properties through a scoped slot. + +| **Property** | **Type** | **Description** | +| --- | :---: | --- | +| `commands` | `Array` | A list of all commands. | +| `isActive` | `Function` | A function to check if your selected text is a node or mark. `isActive({node|mark}, attrs)` | +| `markAttrs` | `Function` | A function to get all mark attributes of your selection. | +| `focused` | `Boolean` | Whether the editor is focused. | +| `focus` | `Function` | A function to focus the editor. | +| `menu` | `Object` | An object for positioning your menu. | + +#### Example + +```vue + +``` + ## Extensions By default, the editor will only support paragraphs. Other nodes and marks are available as **extensions**. There is a package called `tiptap-extensions` with the most basic nodes, marks, and plugins. @@ -90,71 +173,75 @@ By default, the editor will only support paragraphs. Other nodes and marks are a ```vue ``` @@ -230,7 +317,7 @@ export default class BlockquoteNode extends Node { // this command will be called from menus to add a blockquote // `type` is the prosemirror schema object for this blockquote // `schema` is a collection of all registered nodes and marks - command({ type, schema }) { + commands({ type, schema }) { return wrapIn(type) } @@ -327,49 +414,6 @@ export default class IframeNode extends Node { } ``` -## Building a Menu - -This is a basic example of building a custom menu. A more advanced menu can be found at the [examples page](https://tiptap.scrumpy.io). - -```vue - - - -``` - ## Development Setup Currently, only Yarn is supported for development because of a feature called workspaces we are using here.