-
Notifications
You must be signed in to change notification settings - Fork 481
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #36375 from code-dot-org/dtp_candidate_4aae1d87
DTP (Test > Production: 4aae1d8)
- Loading branch information
Showing
56 changed files
with
382 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import PropTypes from 'prop-types'; | ||
import React from 'react'; | ||
import SafeMarkdown from '@cdo/apps/templates/SafeMarkdown'; | ||
import color from '@cdo/apps/util/color'; | ||
|
||
const styles = { | ||
box: { | ||
marginTop: 10, | ||
marginBottom: 10, | ||
border: '1px solid ' + color.light_gray, | ||
padding: 10 | ||
} | ||
}; | ||
|
||
/** | ||
* Component for previewing Markdown for a edit field | ||
*/ | ||
export default class MarkdownPreview extends React.Component { | ||
static propTypes = { | ||
markdown: PropTypes.string.isRequired | ||
}; | ||
|
||
render() { | ||
return ( | ||
<div> | ||
<div style={{marginBottom: 5}}>Preview:</div> | ||
<div style={styles.box}> | ||
<SafeMarkdown | ||
openExternalLinksInNewTab={true} | ||
markdown={this.props.markdown} | ||
/> | ||
</div> | ||
</div> | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import {expect} from 'chai'; | ||
import React from 'react'; | ||
import {mount} from 'enzyme'; | ||
import MarkdownPreview from '@cdo/apps/lib/script-editor/MarkdownPreview'; | ||
|
||
const DEFAULT_PROPS = { | ||
markdown: | ||
'# Title \n This is the unit description with [link](https://studio.code.org/home) **Bold** *italics*' | ||
}; | ||
|
||
describe('ScriptEditor', () => { | ||
it('has correct markdown for preview of unit description', () => { | ||
const wrapper = mount(<MarkdownPreview {...DEFAULT_PROPS} />); | ||
expect(wrapper.find('SafeMarkdown').length).to.equal(1); | ||
expect(wrapper.find('SafeMarkdown').prop('markdown')).to.equal( | ||
'# Title \n This is the unit description with [link](https://studio.code.org/home) **Bold** *italics*' | ||
); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.