Skip to content

Commit

Permalink
localize error message, fix review comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
Grace committed Mar 25, 2020
1 parent 6dd2258 commit 735b21c
Showing 1 changed file with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,17 +69,15 @@ const propTypes = {

const defaultProps = {};

const markdownPlaceHolder = `# ✨Markdown
const MARKDOWN_PLACE_HOLDER = `# ✨Markdown
## ✨Markdown
### ✨Markdown
<br />
Click here to edit [markdown](https://bit.ly/1dQOfRK)`;

const emergencyCode = `
This markdown component has an error.
`;
const MARKDOWN_ERROR_MESSAGE = t('This markdown component has an error.');

function isSafeMarkup(node) {
if (node.type === 'html') {
Expand Down Expand Up @@ -243,7 +241,7 @@ class Markdown extends React.PureComponent {
// thisl allows "select all => delete" to give an empty editor
typeof this.state.markdownSource === 'string'
? this.state.markdownSource
: markdownPlaceHolder
: MARKDOWN_PLACE_HOLDER
}
readOnly={false}
onLoad={this.setEditor}
Expand All @@ -257,8 +255,8 @@ class Markdown extends React.PureComponent {
<ReactMarkdown
source={
hasError
? emergencyCode
: this.state.markdownSource || markdownPlaceHolder
? MARKDOWN_ERROR_MESSAGE
: this.state.markdownSource || MARKDOWN_PLACE_HOLDER
}
escapeHtml={false}
allowNode={isSafeMarkup}
Expand Down

0 comments on commit 735b21c

Please sign in to comment.