Skip to content

Commit 97f242c

Browse files
committed
remove points from faq that don't apply anymore
1 parent 2a2d697 commit 97f242c

File tree

1 file changed

+0
-41
lines changed

1 file changed

+0
-41
lines changed

FAQ.md

-41
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,5 @@
11
# Frequently Asked Questions
22

3-
## How to reset the content?
4-
5-
Since the decorators are stored in the EditorState it's important to not reset
6-
the complete EditorState. The proper way is to reset the ContentState which is
7-
part of the EditorState. In addition this ensures proper undo/redo behavior.
8-
9-
Right:
10-
```js
11-
import { EditorState, ContentState } from 'draft-js';
12-
13-
const editorState = EditorState.push(this.state.editorState, ContentState.createFromText(''));
14-
this.setState({ editorState });
15-
```
16-
17-
Wrong:
18-
```js
19-
import { EditorState } from 'draft-js';
20-
21-
this.setState({ editorState: EditorState.createEmpty() })
22-
```
23-
24-
## Why are mentions broken after using `convertFromRaw` and throwing an error?
25-
26-
__Please Note: this has been fixed in the beta version, from now on you can use a plain array for your mention suggestions__
27-
28-
We design the API to accept an Immutable Map for a Mention. After saving your data structure to the server and using `convertFromRaw`, the mentions in there are plain objects. I (Nik) believe this is a flaw in our design and the mention data should be a plain object. Hint: we might fix this with v2.0.0 of the mentions plugin.
29-
30-
What you can do now is fixing the datastructure before converting it:
31-
32-
```JS
33-
import { fromJS} from 'immutable';
34-
import forEach from 'lodash/forEach';
35-
36-
forEach(rawContent.entityMap, function(value, key) {
37-
value.data.mention = fromJS(value.data.mention)
38-
})
39-
40-
const contentState = Draft.convertFromRaw(rawContent)
41-
const editorState = Draft.EditorState.createWithContent(contentState)
42-
```
43-
443
## Why is there no Popover for Mentions/Emoji plugin?
454

465
The MentionSuggestions/EmojiSuggestions component is internally connected to the

0 commit comments

Comments
 (0)