Preview.js 955 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import React from 'react';
  2. import PropTypes from 'prop-types';
  3. import RevisionBody from '../Page/RevisionBody';
  4. import { PreviewOptions } from './OptionsSelector';
  5. /**
  6. * Wrapper component for Page/RevisionBody
  7. */
  8. export default class Preview extends React.Component {
  9. constructor(props) {
  10. super(props);
  11. }
  12. render() {
  13. const renderMathJaxInRealtime = this.props.previewOptions.renderMathJaxInRealtime;
  14. return (
  15. <div className="page-editor-preview-body"
  16. ref={(elm) => {
  17. this.props.inputRef(elm);
  18. }}>
  19. <RevisionBody
  20. {...this.props}
  21. renderMathJaxInRealtime={renderMathJaxInRealtime}
  22. />
  23. </div>
  24. )
  25. }
  26. }
  27. Preview.propTypes = {
  28. html: PropTypes.string,
  29. inputRef: PropTypes.func.isRequired, // for getting div element
  30. isMathJaxEnabled: PropTypes.bool,
  31. renderMathJaxOnInit: PropTypes.bool,
  32. previewOptions: PropTypes.instanceOf(PreviewOptions),
  33. };