Skip to content
Snippets Groups Projects
Commit 80bd1190 authored by Tim's avatar Tim
Browse files

devmode

parent 7031c9ea
No related branches found
No related tags found
No related merge requests found
......@@ -16,6 +16,13 @@ const remarkable = new Remarkable({
quotes: '“”‘’'
})
function escapeHtml(html) {
return document.createElement('div')
.appendChild(document.createTextNode(html))
.parentNode
.innerHTML
}
class MarkdownViewer extends Component {
static propTypes = {
......@@ -42,6 +49,14 @@ class MarkdownViewer extends Component {
this.state = {allowNoImage: true}
}
showRaw(e, html) {
e.preventDefault();
var x=window.open();
x.document.open();
x.document.write('<pre>' + escapeHtml(html) + '</pre>');
x.document.close();
}
shouldComponentUpdate(np, ns) {
return np.text !== this.props.text ||
np.large !== this.props.large ||
......@@ -140,6 +155,7 @@ class MarkdownViewer extends Component {
<button style={{marginBottom: 0}} className="button hollow tiny float-right">Show</button>
</div>
}
<center><small><a href="#" onClick={e => this.showRaw(e, this.props.text)}>[raw {html ? 'html' : 'markdown'}]</a></small></center>
</div>)
}
}
......
......@@ -277,10 +277,10 @@ class PostFull extends React.Component {
</div>)
}
const readonly = post_content.get('mode') === 'archived' || $STM_Config.read_only_mode
const readonly = (post_content.get('mode') === 'archived' || $STM_Config.read_only_mode) && !(process.env.NODE_ENV === 'development')
const showPromote = username && post_content.get('mode') === "first_payout" && post_content.get('depth') == 0
const showReplyOption = post_content.get('depth') < 6
const showEditOption = username === author
const showEditOption = username === author || (process.env.NODE_ENV === 'development')
const showDeleteOption = username === author && post_content.get('children') === 0 && content.stats.netVoteSign <= 0
const authorRepLog10 = repLog10(content.author_reputation)
......
......@@ -351,7 +351,7 @@ class ReplyEditor extends React.Component {
<input type="text" className="ReplyEditor__title" {...title.props} onChange={onTitleChange} disabled={loading} placeholder="Title" autoComplete="off" ref="titleRef" tabIndex={1} />
<div className="float-right secondary" style={{marginRight: '1rem'}}>
{rte && <a href="#" onClick={this.toggleRte}>{body.value ? 'Raw HTML' : 'Markdown'}</a>}
{!rte && (isHtml || !body.value) && <a href="#" onClick={this.toggleRte}>Editor</a>}
{!rte && <a href="#" onClick={this.toggleRte}>Editor</a>}
</div>
{titleError}
</span>}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment