From 34e13eb31438e8c0ec0a19db74353c4250907257 Mon Sep 17 00:00:00 2001 From: iseulde Date: Tue, 26 Feb 2019 17:22:32 +0100 Subject: [PATCH] Move create docs inline --- packages/rich-text/README.md | 15 --------------- packages/rich-text/src/create.js | 21 +++++++++++++++++++++ 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/packages/rich-text/README.md b/packages/rich-text/README.md index 1d5220f417cf8..7ac35306d8617 100644 --- a/packages/rich-text/README.md +++ b/packages/rich-text/README.md @@ -29,21 +29,6 @@ create( { Create a RichText value from an `Element` tree (DOM), an HTML string or a plain text string, with optionally a `Range` object to set the selection. If called without any arguments, an empty value will be created. If `multilineTag` is provided, any content of direct children whose type matches `multilineTag` will be separated by a line separator. -A value will have the following shape, which you are strongly encouraced not to modify without the use of helper functions: - -```js -{ - text: string, - formats: Array, - objects: Array, - lines: Array, - ?start: number, - ?end: number, -} -``` - -As you can see, text and formatting are separated. `text` holds the text, including any replacement characters for objects and lines. `formats`, `objects` and `lines` are all sparse arrays of the same length as `text`. It holds information about the formatting at the relevant text indices. Finally `start` and `end` state which text indices are selected. They are only provided if a `Range` was given. - ### toHTMLString ```js diff --git a/packages/rich-text/src/create.js b/packages/rich-text/src/create.js index 6779a8287d75c..39adeb002c166 100644 --- a/packages/rich-text/src/create.js +++ b/packages/rich-text/src/create.js @@ -95,6 +95,27 @@ function toFormat( { type, attributes } ) { * `multilineTag` will be separated by two newlines. The optional functions can * be used to filter out content. * + * A value will have the following shape, which you are strongly encouraced not + * to modify without the use of helper functions: + * + * ```js + * { + * text: string, + * formats: Array, + * objects: Array, + * lines: Array, + * ?start: number, + * ?end: number, + * } + * ``` + * + * As you can see, text and formatting are separated. `text` holds the text, + * including any replacement characters for objects and lines. `formats`, + * `objects` and `lines` are all sparse arrays of the same length as `text`. It + * holds information about the formatting at the relevant text indices. Finally + * `start` and `end` state which text indices are selected. They are only + * provided if a `Range` was given. + * * @param {?Object} $1 Optional named argements. * @param {?Element} $1.element Element to create value from. * @param {?string} $1.text Text to create value from.