-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.js
36 lines (34 loc) · 1.13 KB
/
App.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import React from 'react';
import {Editor, EditorState} from 'draft-js';
import './App.css';
class App extends React.Component {
constructor(props) {
super(props);
this.state = {
editorState: EditorState.createEmpty(),
status: '',
};
this.onChange = (editorState) => this.setState({ editorState });
}
render() {
return (
<div>
<h2>How to reproduce the issue:</h2>
<ol>
<li>{"Press enter should be handled by handleReturn (handleReturn={()=>'handled'}"}</li>
<li>Drag a file and drop it</li>
<li>Drag a file and not drop it</li>
<li>Press enter will not be handled anymore (bug)</li>
</ol>
<div>Current Status of callback: {this.state.status}</div>
<Editor
editorState={this.state.editorState}
onChange={this.onChange}
handleReturn={() => { this.setState({ status: 'handleReturn is triggered.' }); return 'handled'; }}
handleDroppedFiles={() => { this.setState({ status: 'hanldeDroppedFiles is triggered.' }); return 'handled'; }}
/>
</div>
);
}
}
export default App;