Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RichText: change value to have separate keys for line and object formats #13948

Merged
merged 18 commits into from
Mar 13, 2019
Merged
Prev Previous commit
Next Next commit
Add some extra info to create docs
  • Loading branch information
ellatrix committed Mar 12, 2019
commit 279bf24805f5e1de881eb58c125d69082ff0137f
44 changes: 29 additions & 15 deletions packages/rich-text/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,23 @@ is no format at the selection.

`(Object|undefined)`: Active format object of the specified type, or undefined.

### getActiveObject

[src/index.js#L11-L11](src/index.js#L11-L11)

Gets the active object, if there is any.

**Parameters**

- **value** `Object`: Value to inspect.

**Returns**

`?Object`: Active object, or undefined.

### getTextContent

[src/index.js#L13-L13](src/index.js#L13-L13)
[src/index.js#L14-L14](src/index.js#L14-L14)

Get the textual content of a Rich Text value. This is similar to
`Element.textContent`.
Expand All @@ -110,7 +124,7 @@ Get the textual content of a Rich Text value. This is similar to

### insert

[src/index.js#L21-L21](src/index.js#L21-L21)
[src/index.js#L22-L22](src/index.js#L22-L22)

Insert a Rich Text value, an HTML string, or a plain text string, into a
Rich Text value at the given `startIndex`. Any content between `startIndex`
Expand All @@ -130,7 +144,7 @@ none are provided.

### insertObject

[src/index.js#L24-L24](src/index.js#L24-L24)
[src/index.js#L25-L25](src/index.js#L25-L25)

Insert a format as an object into a Rich Text value at the given
`startIndex`. Any content between `startIndex` and `endIndex` will be
Expand All @@ -149,7 +163,7 @@ removed. Indices are retrieved from the selection if none are provided.

### isCollapsed

[src/index.js#L14-L14](src/index.js#L14-L14)
[src/index.js#L15-L15](src/index.js#L15-L15)

Check if the selection of a Rich Text value is collapsed or not. Collapsed
means that no characters are selected, but there is a caret present. If there
Expand All @@ -166,7 +180,7 @@ is no selection, `undefined` will be returned. This is similar to

### isEmpty

[src/index.js#L15-L15](src/index.js#L15-L15)
[src/index.js#L16-L16](src/index.js#L16-L16)

Check if a Rich Text value is Empty, meaning it contains no text or any
objects (such as images).
Expand All @@ -181,7 +195,7 @@ objects (such as images).

### join

[src/index.js#L16-L16](src/index.js#L16-L16)
[src/index.js#L17-L17](src/index.js#L17-L17)

Combine an array of Rich Text values into one, optionally separated by
`separator`, which can be a Rich Text value, HTML string, or plain text
Expand All @@ -198,7 +212,7 @@ string. This is similar to `Array.prototype.join`.

### registerFormatType

[src/index.js#L17-L17](src/index.js#L17-L17)
[src/index.js#L18-L18](src/index.js#L18-L18)

Registers a new format provided a unique name and an object defining its
behavior.
Expand All @@ -218,7 +232,7 @@ behavior.

### remove

[src/index.js#L19-L19](src/index.js#L19-L19)
[src/index.js#L20-L20](src/index.js#L20-L20)

Remove content from a Rich Text value between the given `startIndex` and
`endIndex`. Indices are retrieved from the selection if none are provided.
Expand All @@ -235,7 +249,7 @@ Remove content from a Rich Text value between the given `startIndex` and

### removeFormat

[src/index.js#L18-L18](src/index.js#L18-L18)
[src/index.js#L19-L19](src/index.js#L19-L19)

Remove any format object from a Rich Text value by type from the given
`startIndex` to the given `endIndex`. Indices are retrieved from the
Expand All @@ -254,7 +268,7 @@ selection if none are provided.

### replace

[src/index.js#L20-L20](src/index.js#L20-L20)
[src/index.js#L21-L21](src/index.js#L21-L21)

Search a Rich Text value and replace the match(es) with `replacement`. This
is similar to `String.prototype.replace`.
Expand All @@ -271,7 +285,7 @@ is similar to `String.prototype.replace`.

### slice

[src/index.js#L25-L25](src/index.js#L25-L25)
[src/index.js#L26-L26](src/index.js#L26-L26)

Slice a Rich Text value from `startIndex` to `endIndex`. Indices are
retrieved from the selection if none are provided. This is similar to
Expand All @@ -289,7 +303,7 @@ retrieved from the selection if none are provided. This is similar to

### split

[src/index.js#L26-L26](src/index.js#L26-L26)
[src/index.js#L27-L27](src/index.js#L27-L27)

Split a Rich Text value in two at the given `startIndex` and `endIndex`, or
split at the given separator. This is similar to `String.prototype.split`.
Expand All @@ -307,7 +321,7 @@ Indices are retrieved from the selection if none are provided.

### toggleFormat

[src/index.js#L29-L29](src/index.js#L29-L29)
[src/index.js#L30-L30](src/index.js#L30-L30)

Toggles a format object to a Rich Text value at the current selection.

Expand All @@ -322,7 +336,7 @@ Toggles a format object to a Rich Text value at the current selection.

### toHTMLString

[src/index.js#L28-L28](src/index.js#L28-L28)
[src/index.js#L29-L29](src/index.js#L29-L29)

Create an HTML string from a Rich Text value. If a `multilineTag` is
provided, text separated by a line separator will be wrapped in it.
Expand All @@ -339,7 +353,7 @@ provided, text separated by a line separator will be wrapped in it.

### unregisterFormatType

[src/index.js#L31-L31](src/index.js#L31-L31)
[src/index.js#L32-L32](src/index.js#L32-L32)

Unregisters a format.

Expand Down