-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
23 changed files
with
352 additions
and
22 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
24 changes: 24 additions & 0 deletions
24
src/editors/containers/TextEditor/components/RawEditor/__snapshots__/index.test.jsx.snap
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,24 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`ImageSettingsModal renders as expected with default behavior 1`] = ` | ||
<div | ||
className="form-group" | ||
style={ | ||
Object { | ||
"padding": "10px 30px", | ||
} | ||
} | ||
> | ||
<Alert | ||
variant="danger" | ||
> | ||
You are using the raw HTML editor. | ||
</Alert> | ||
<textarea | ||
className="form-control" | ||
rows="12" | ||
> | ||
sOmErAwHtml | ||
</textarea> | ||
</div> | ||
`; |
33 changes: 33 additions & 0 deletions
33
src/editors/containers/TextEditor/components/RawEditor/index.jsx
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,33 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { Alert } from '@edx/paragon'; | ||
|
||
export const RawEditor = ({ | ||
editorRef, | ||
text, | ||
}) => ( | ||
<div className="form-group" style={{ padding: '10px 30px' }}> | ||
<Alert variant="danger"> | ||
You are using the raw HTML editor. | ||
</Alert> | ||
<textarea | ||
className="form-control" | ||
ref={editorRef} | ||
rows="12" | ||
> | ||
{ text } | ||
</textarea> | ||
</div> | ||
); | ||
RawEditor.defaultProps = { | ||
editorRef: null, | ||
}; | ||
RawEditor.propTypes = { | ||
editorRef: PropTypes.oneOfType([ | ||
PropTypes.func, | ||
PropTypes.shape({ current: PropTypes.any }), | ||
]), | ||
text: PropTypes.string.isRequired, | ||
}; | ||
|
||
export default RawEditor; |
18 changes: 18 additions & 0 deletions
18
src/editors/containers/TextEditor/components/RawEditor/index.test.jsx
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,18 @@ | ||
import React from 'react'; | ||
import { shallow } from 'enzyme'; | ||
|
||
import { RawEditor } from '.'; | ||
|
||
describe('ImageSettingsModal', () => { | ||
const props = { | ||
editorRef: { | ||
current: { | ||
value: 'Ref Value', | ||
}, | ||
}, | ||
text: 'sOmErAwHtml', | ||
}; | ||
test('renders as expected with default behavior', () => { | ||
expect(shallow(<RawEditor {...props} />)).toMatchSnapshot(); | ||
}); | ||
}); |
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
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.