const React = require('react'); const _ = require('lodash'); const cx = require('classnames'); const Markdown = require('homebrewery/markdown.js'); const Headtags = require('vitreum/headtags'); const PrintPage = React.createClass({ getDefaultProps: function() { return { query : {}, brew : { text : '', style : '' } }; }, getInitialState: function() { return { brew: this.props.brew }; }, componentDidMount: function() { if(this.props.query.local){ try{ this.setState({ brew : JSON.parse( localStorage.getItem(this.props.query.local) ) }); }catch(e){} } if(this.props.query.dialog) window.print(); }, //TODO: Print page shouldn't replicate functionality in brew renderer renderStyle : function(){ if(!this.state.brew.style) return; return }, renderPages : function(){ return _.map(this.state.brew.text.split('\\page'), (page, index) => { return
; }); }, renderPrintInstructions : function(){ return