import { EOL } from 'os' import React from 'react' import domtoimage from 'dom-to-image' import CodeMirror from 'react-codemirror' import WindowControls from '../components/svg/controls' // hack to only call modes on browser if (typeof window !== 'undefined' && typeof window.navigator !== 'undefined') { require('codemirror/mode/javascript/javascript'); require('codemirror/mode/xml/xml'); require('codemirror/mode/markdown/markdown'); } const margin = '45px 54px' const padding = '50px 50px' class CodeImage extends React.Component { constructor (props) { super(props) this.state = { code: this.props.children } } updateCode (newCode) { this.setState({ code: newCode }) } render () { const options = { lineNumbers: false, mode: 'javascript' } return (