Created
January 4, 2019 13:58
-
-
Save jkhaui/c8e45bc7beabedf705c56e1f2b2c4fe8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react'; | |
import 'whatwg-fetch'; | |
import MediumEditor from 'medium-editor'; | |
import Citation from './citation.js'; | |
class BookCitation extends Component { | |
constructor( props ) { | |
super( props ) | |
this.state = { | |
editor : null, | |
} | |
this.editorContainer = React.createRef() | |
} | |
componentDidMount() { | |
this.setState({ editor : new MediumEditor( this.editorContainer.current ) }) | |
} | |
render() { | |
return( | |
<Citation | |
editor={ this.state.editor } | |
bookNotFound={ | |
book => document.getElementById("editor").innerHTML = | |
'No book was found. Try refining the title or author names.' | |
} | |
> | |
<div id="editor" ref={ this.editorContainer } /> | |
</Citation> | |
) | |
} | |
} | |
export default BookCitation; |
import React, { Component } from 'react'; import 'whatwg-fetch'; import MediumEditor from 'medium-editor'; import Citation from './citation.js'; class BookCitation extends Component { constructor( props ) { super( props ) this.state = { editor : null, } this.editorContainer = React.createRef() } componentDidMount() { this.setState({ editor : new MediumEditor( this.editorContainer.current, { placeholder : {} } ) }) } render() { return( <Citation editor={ this.state.editor } bookNotFound={ book => document.getElementById("editor").innerHTML = 'No book was found. Try refining the title or author names.' } > <div id="editor" ref={ this.editorContainer } /> </Citation> ) } } export default BookCitation;
Omg yassssss
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.