0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-02 10:42:44 +00:00

Adding a source route instead of jsut opening a new window

This commit is contained in:
Scott Tolksdorf
2016-05-14 13:08:27 -04:00
parent b464de69e3
commit c1d7443c87
5 changed files with 18 additions and 21 deletions

View File

@@ -9,10 +9,6 @@ var PrintLink = require('../../navbar/print.navitem.jsx');
var BrewRenderer = require('../../brewRenderer/brewRenderer.jsx');
var replaceAll = function(str, find, replace) {
return str.replace(new RegExp(find, 'g'), replace);
}
var SharePage = React.createClass({
getDefaultProps: function() {
return {
@@ -27,14 +23,6 @@ var SharePage = React.createClass({
};
},
openSourceWindow : function(){
var sourceWindow = window.open();
var content = replaceAll(this.props.brew.text, '<', '&lt;');
content = replaceAll(content, '>', '&gt;');
sourceWindow.document.write('<code><pre>' + content + '</pre></code>');
},
render : function(){
return <div className='sharePage page'>
<Navbar>
@@ -44,7 +32,7 @@ var SharePage = React.createClass({
<Nav.section>
<PrintLink shareId={this.props.brew.shareId} />
<Nav.item onClick={this.openSourceWindow} color='teal' icon='fa-code'>
<Nav.item href={'/homebrew/source/' + this.props.brew.shareId} color='teal' icon='fa-code'>
source
</Nav.item>
</Nav.section>

View File

@@ -28,7 +28,7 @@ var Main = React.createClass({
icon : <HomebrewIcon />,
desc : 'Make authentic-looking 5e homebrews using Markdown',
show : true,
show : false,
beta : true
},
{