You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
917 B
30 lines
917 B
import React,{ Component } from "react";
|
|
import { markdownToHTML } from 'educoder'
|
|
class MarkdownToHtml extends Component{
|
|
constructor(props){
|
|
super(props);
|
|
this.state={
|
|
}
|
|
}
|
|
componentDidUpdate = (prevProps) => {
|
|
if (this.props.content) {
|
|
if ( prevProps.content != this.props.content ) {
|
|
markdownToHTML(this.props.content, `.markdown_to_html_${this.props.selector || ''}`)
|
|
}
|
|
}
|
|
}
|
|
componentDidMount () {
|
|
this.props.content && markdownToHTML(this.props.content, `.markdown_to_html_${this.props.selector || ''}`)
|
|
|
|
}
|
|
render(){
|
|
|
|
return(
|
|
<div id="memo_content_editorMd" className={`new_li markdown-body ${this.props.className} markdown_to_html_${this.props.selector || ''}`}
|
|
// dangerouslySetInnerHTML={{__html: markdownToHTML(this.props.content)}}
|
|
>
|
|
</div>
|
|
)
|
|
}
|
|
}
|
|
export default MarkdownToHtml; |