Skip to content
This repository has been archived by the owner on Feb 6, 2023. It is now read-only.

Update documentation concerning immutable updates #1884

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions docs/APIReference-ContentState.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,13 @@ objects.

> Use [Immutable Map API](http://facebook.github.io/immutable-js/docs/#/Map) to
> set properties.
>
> **Example**
> ```
> const editorState = EditorState.createEmpty();
> const contentState = editorState.getCurrentContent();
> const contentStateWithSelectionBefore = contentState.set('selectionBefore', SelectionState.createEmpty(contentState.getBlockForKey('1pu4d')));
> ```

<ul class="apiIndex">
<li>
Expand Down
9 changes: 8 additions & 1 deletion docs/APIReference-EditorState.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,14 @@ The list below includes the most commonly used instance methods for `EditorState
> Note
>
> Use the static `EditorState` methods to set properties, rather than using
> the Immutable API directly.
> the Immutable API directly. This means using `EditorState.set` to pass
> new options to an EditorState instance.
>
> **Example**
> ```
> const editorState = EditorState.createEmpty();
> const editorStateWithoutUndo = EditorState.set(editorState, {allowUndo: false});
> ```

<ul class="apiIndex">
<li>
Expand Down
7 changes: 7 additions & 0 deletions docs/APIReference-SelectionState.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,13 @@ _Start_ and _end_ values are derived.

> Use [Immutable Map API](http://facebook.github.io/immutable-js/docs/#/Record/Record) to
> set properties.
>
> **Example**
> ```
> const selectionState = SelectionState.createEmpty();
> const selectionStateWithNewFocusOffset = selection.set('focusOffset', 1);
> ```


<ul class="apiIndex">
<li>
Expand Down