Skip to content

Commit

Permalink
Docs: add explicit deprecation notes to Entity methods (#1787)
Browse files Browse the repository at this point in the history
Summary:
**Summary**

The note in the docs `Please note that the API for entity storage and management has changed recently; for details on updating your application see our v0.10 API Migration Guide` doesn't give a quick clear idea of what I should use instead of the old methods (I need to go to that migration guide, but let's suppose I'm a new user and I don't have any code to migrate). The problem becomes obvious after getting warnings in the browser console.  So my suggestion is to place deprecation notice right in the name header. I believe this would save some time for those who open docs just to see the method signatures.

Now (https://draftjs.org/docs/api-reference-entity.html):
![image](https://user-images.githubusercontent.com/439939/41491613-39a1cfb2-710b-11e8-849b-4f8a13bf9088.png)

What I suggest:
![image](https://user-images.githubusercontent.com/439939/41491621-43f89af4-710b-11e8-8d71-2c3c20054e42.png)
Pull Request resolved: facebookarchive/draft-js#1787

Differential Revision: D10234733

fbshipit-source-id: 8f7c32ad4f0da203ffe0a80584781413681ba158
  • Loading branch information
aforismesen authored and facebook-github-bot committed Oct 7, 2018
1 parent d704edd commit 7fd36c3
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions docs/APIReference-Entity.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ be used only for retrieval.

## Methods

### create
### create _(Deprecated in favour of [contentState.createEntity](/docs/api-reference-content-state.html#createentity))_

```
create(
Expand All @@ -70,7 +70,7 @@ are referenced by their string key in `ContentState`. The string value should
be used within `CharacterMetadata` objects to track the entity for annotated
characters.

### add
### add _(Deprecated in favour of [contentState.addEntity](/docs/api-reference-content-state.html#addentity))_

```
add(instance: DraftEntityInstance): string
Expand All @@ -83,15 +83,15 @@ created, and now need to be added to the `Entity` store. This may occur in cases
where a vanilla JavaScript representation of a `ContentState` is being revived
for editing.

### get
### get _(Deprecated in favour of [contentState.getEntity](/docs/api-reference-content-state.html#getentity))_

```
get(key: string): DraftEntityInstance
```
Returns the `DraftEntityInstance` for the specified key. Throws if no instance
exists for that key.

### mergeData
### mergeData _(Deprecated in favour of [contentState.mergeEntityData](/docs/api-reference-content-state.html#mergeentitydata))_

```
mergeData(
Expand All @@ -104,7 +104,7 @@ metadata through typical mutative means.

The `mergeData` method allows you to apply updates to the specified entity.

### replaceData
### replaceData _(Deprecated in favour of [contentState.replaceEntityData](/docs/api-reference-content-state.html#replaceentitydata))_

```
replaceData(
Expand Down

0 comments on commit 7fd36c3

Please sign in to comment.