@@ -3,7 +3,8 @@ import ReactDOM from 'react-dom';
33import insertDataBlock from 'draft-js-buttons-plugin/lib/utils/insertDataBlock.js' ;
44import axios from 'axios' ;
55
6- const token = `?token=f9403fc5f537b4ab332d` ;
6+ const token = '?token=token' ;
7+ const serverURL = 'http://localhost:25478' ;
78
89export default class imageButton extends Component {
910 onClick = e => {
@@ -15,10 +16,10 @@ export default class imageButton extends Component {
1516 const file = e . target . files [ 0 ] ;
1617 const params = new FormData ( ) ;
1718 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 , {
1920 headers : { 'Content-Type' : `multipart/form-data; boundary=${ params . _boundary } ` }
2021 } ) ;
21- const imageData = { src : `http://localhost:25478 /${ response . data . path } ${ token } ` , type : 'placeholder' } ;
22+ const imageData = { src : `${ serverURL } /${ response . data . path } ${ token } ` , type : 'placeholder' } ;
2223 this . props . setEditorState ( insertDataBlock ( this . props . getEditorState ( ) , imageData , 'image' ) ) ;
2324 } ;
2425
@@ -29,7 +30,7 @@ export default class imageButton extends Component {
2930 render ( ) {
3031 const { theme } = this . props ;
3132 return (
32- < div className = { theme . buttonWrapper } onMouseDown = { this . preventBubblingUp } >
33+ < div className = { theme . buttonWrapper } onMouseDown = { this . preventBubblingUp } style = { { color : 'inherit' } } >
3334 < button className = { theme . button } onClick = { this . onClick } type = "button" >
3435 < svg width = "24" height = "24" viewBox = "0 0 24 24" >
3536 < path
@@ -41,7 +42,7 @@ export default class imageButton extends Component {
4142 </ button >
4243
4344 < 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' } } />
4546 </ div >
4647 </ div >
4748 ) ;
0 commit comments