@@ -3,7 +3,8 @@ import ReactDOM from 'react-dom';
3
3
import insertDataBlock from 'draft-js-buttons-plugin/lib/utils/insertDataBlock.js' ;
4
4
import axios from 'axios' ;
5
5
6
- const token = `?token=f9403fc5f537b4ab332d` ;
6
+ const token = '?token=token' ;
7
+ const serverURL = 'http://localhost:25478' ;
7
8
8
9
export default class imageButton extends Component {
9
10
onClick = e => {
@@ -15,10 +16,10 @@ export default class imageButton extends Component {
15
16
const file = e . target . files [ 0 ] ;
16
17
const params = new FormData ( ) ;
17
18
params . append ( 'file' , file ) ;
18
- const response = await axios . post ( `http://localhost:25478 /upload${ token } ` , params , {
19
+ const response = await axios . post ( `${ serverURL } /upload${ token } ` , params , {
19
20
headers : { 'Content-Type' : `multipart/form-data; boundary=${ params . _boundary } ` }
20
21
} ) ;
21
- const imageData = { src : `http://localhost:25478 /${ response . data . path } ${ token } ` , type : 'placeholder' } ;
22
+ const imageData = { src : `${ serverURL } /${ response . data . path } ${ token } ` , type : 'placeholder' } ;
22
23
this . props . setEditorState ( insertDataBlock ( this . props . getEditorState ( ) , imageData , 'image' ) ) ;
23
24
} ;
24
25
@@ -29,7 +30,7 @@ export default class imageButton extends Component {
29
30
render ( ) {
30
31
const { theme } = this . props ;
31
32
return (
32
- < div className = { theme . buttonWrapper } onMouseDown = { this . preventBubblingUp } >
33
+ < div className = { theme . buttonWrapper } onMouseDown = { this . preventBubblingUp } style = { { color : 'inherit' } } >
33
34
< button className = { theme . button } onClick = { this . onClick } type = "button" >
34
35
< svg width = "24" height = "24" viewBox = "0 0 24 24" >
35
36
< path
@@ -41,7 +42,7 @@ export default class imageButton extends Component {
41
42
</ button >
42
43
43
44
< div className = { theme . addImage } >
44
- < input type = "file" ref = "fileInput" onChange = { :: this . inputChange } style = { { display : 'none' } } />
45
+ < input type = "file" ref = "fileInput" onChange = { this . inputChange } style = { { display : 'none' } } />
45
46
</ div >
46
47
</ div >
47
48
) ;
0 commit comments