From 0bdb8c65766ff51d04140b2ec35462fa73812209 Mon Sep 17 00:00:00 2001 From: freedomlang Date: Sun, 28 Oct 2018 22:25:12 +0800 Subject: [PATCH 1/2] docs(core): add missing props and simplified documentation --- packages/core/README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/core/README.md b/packages/core/README.md index f24f50f..da3ae78 100644 --- a/packages/core/README.md +++ b/packages/core/README.md @@ -20,7 +20,7 @@ import { ### Usage -`EditorContainer` contains all props for the draft js Editor which it passes down to plugins and the `Editor` via the React context api. +`EditorContainer` contains all props for the draft js Editor which it passes down to plugins and the `Editor` via the [React context api](https://reactjs.org/docs/context.html). ```js import { EditorContainer } from '@djsp/core' @@ -38,6 +38,7 @@ Here are the props that `EditorContainer` accepts, all of the below props are in | - | - | - | - | | `editorState` | `EditorState` | required | The state of the editor. Identical to the [draft js editorState prop](https://draftjs.org/docs/api-reference-editor#editorstate) | | `onChange` | `(EditorState) => void` | required | Fired when content changes. Identical to the [draft js onChange prop](https://draftjs.org/docs/api-reference-editor#onchange) | +| `editorKey` | `string` | optional | Overrides [props set via plugin](#setEditorProps) | | `textAlignment` | `"left" or "center" or "right"` | optional | Overrides [props set via plugin](#setEditorProps) | | `textDirectionality` | `"LTR" or "RTL"` | optional | Overrides [props set via plugin](#setEditorProps) | | `placeholder` | `string` | optional | Overrides [props set via plugin](#setEditorProps) | @@ -139,7 +140,7 @@ The `Plugin` also accepts an optional render prop which exposes the plugin conte | - | - | - | | `editorState` | `EditorState` | The `EditorState` object | | `setEditorState` | `(editorState: EditorState) => void` | Lets you update the editorState | -| `editorProps` | `Object` | Contains props that can be set via `setEditorProps`, these are `editorKey` `placeholder` `textAlignment` `textDirectionality` `readOnly` `spellCheck` `stripPastedStyles` `tabIndex` `autoCapitalize` `autoComplete` `autoCorrect` `ariaActiveDescendantID` `ariaAutoComplete` `ariaControls` `ariaDescribedBy` `ariaExpanded` `ariaLabel` `ariaLabelledBy` `ariaMultiline` `webDriverTestID` | +| `editorProps` | `Object` | Contains the [props for `EditorContainer`](#props) except `editorState` and `onChange` | | `setEditorProps` | `(editorProps: Object) => void` | lets you set the above editorProps. Be aware that editor props set via Plugins are overridden by `EditorContainer` props | | `editorRef` | `Ref` | A React reference to the draft js editor | From 7fb581c324678bc2b262acd7581cc61d037d2e22 Mon Sep 17 00:00:00 2001 From: freedomlang Date: Sun, 28 Oct 2018 22:41:22 +0800 Subject: [PATCH 2/2] docs(atomic-block): update docs for atomic-block --- packages/atomic-block/README.md | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/packages/atomic-block/README.md b/packages/atomic-block/README.md index 723628b..8f76330 100644 --- a/packages/atomic-block/README.md +++ b/packages/atomic-block/README.md @@ -1,10 +1,19 @@ -# djs@atomic-block - Not released, please use with caution ;) +# @djsp/atomic-block ![file size](http://img.badgesize.io/https://unpkg.com/@djsp/atomic-block/dist/index.js?label=size&style=flat-square) [![NPM](https://img.shields.io/npm/v/@djsp/atomic-block.svg)](https://www.npmjs.com/package/@djsp/atomic-block) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com) +## Installation -Example: +`@djsp/atomic-block` depends on `@djsp/utils` which must also be installed. + +```sh +npm install --save @djsp/utils @djsp/atomic-block +# or alternately +yarn add @djsp/utils @djsp/atomic-block +``` + +## Usage ```jsx @@ -19,3 +28,6 @@ Example: ``` + +## Examples +- [Editor with image](https://codesandbox.io/s/github/draft-js-plugins/next/tree/master/examples/atomic-block) \ No newline at end of file