Skip to content

Commit

Permalink
Merge pull request hackerwins#51 from SerdarSanri/SerdarSanri-patch-1
Browse files Browse the repository at this point in the history
changes to support more complex values and tags
  • Loading branch information
i-kitaev authored Mar 30, 2019
2 parents 5571348 + 265e6d3 commit 87e545a
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/Summernote.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -193,20 +193,19 @@ class ReactSummernote extends Component {
}

render() {
const { value, defaultValue, className } = this.props;
const html = value || defaultValue;
const { tag: Tag, children, className } = this.props;

return (
<div className={className}>
<div id={this.uid} dangerouslySetInnerHTML={{ __html: html }} />
<Tag id={this.uid}>{children}</Tag>
</div>
);
}
}

ReactSummernote.propTypes = {
value: PropTypes.string,
defaultValue: PropTypes.string,
tag: PropTypes.string, // will determing using div or textarea field for form components like redux-form
children: PropTypes.node, // instead of value, using children makes more sense for div and textarea blocks
codeview: PropTypes.bool,
className: PropTypes.string,
options: PropTypes.object,
Expand All @@ -222,4 +221,7 @@ ReactSummernote.propTypes = {
onImageUpload: PropTypes.func
};

ReactSummernote.defaultProps = {
tag: 'div'
};
export default ReactSummernote;

0 comments on commit 87e545a

Please sign in to comment.