mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-12 13:12:46 +00:00
Apply Legacy\v3 renderer to print page (#1235)
This commit is contained in:
@@ -4,6 +4,7 @@ const createClass = require('create-react-class');
|
|||||||
const _ = require('lodash');
|
const _ = require('lodash');
|
||||||
const cx = require('classnames');
|
const cx = require('classnames');
|
||||||
const { Meta } = require('vitreum/headtags');
|
const { Meta } = require('vitreum/headtags');
|
||||||
|
const MarkdownLegacy = require('naturalcrit/markdownLegacy.js');
|
||||||
const Markdown = require('naturalcrit/markdown.js');
|
const Markdown = require('naturalcrit/markdown.js');
|
||||||
|
|
||||||
const PrintPage = createClass({
|
const PrintPage = createClass({
|
||||||
@@ -11,7 +12,8 @@ const PrintPage = createClass({
|
|||||||
return {
|
return {
|
||||||
query : {},
|
query : {},
|
||||||
brew : {
|
brew : {
|
||||||
text : '',
|
text : '',
|
||||||
|
renderer : 'legacy'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@@ -33,13 +35,24 @@ const PrintPage = createClass({
|
|||||||
},
|
},
|
||||||
|
|
||||||
renderPages : function(){
|
renderPages : function(){
|
||||||
return _.map(this.state.brewText.split('\\page'), (page, index)=>{
|
if(this.props.brew.renderer == 'legacy') {
|
||||||
return <div
|
return _.map(this.state.brewText.split('\\page'), (page, index)=>{
|
||||||
className='phb'
|
return <div
|
||||||
id={`p${index + 1}`}
|
className='phb'
|
||||||
dangerouslySetInnerHTML={{ __html: Markdown.render(page) }}
|
id={`p${index + 1}`}
|
||||||
key={index} />;
|
dangerouslySetInnerHTML={{ __html: MarkdownLegacy.render(page) }}
|
||||||
});
|
key={index} />;
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
return _.map(this.state.brewText.split(/^\\page/gm), (page, index)=>{
|
||||||
|
return <div
|
||||||
|
className='phb3'
|
||||||
|
id={`p${index + 1}`}
|
||||||
|
dangerouslySetInnerHTML={{ __html: Markdown.render(page) }}
|
||||||
|
key={index} />;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
render : function(){
|
render : function(){
|
||||||
|
|||||||
Reference in New Issue
Block a user