Skip to content

Commit c9c4ca1

Browse files
committed
feat: add validateAssetUrl prop to TextEditor component
1 parent d23670e commit c9c4ca1

2 files changed

Lines changed: 5 additions & 0 deletions

File tree

src/editors/containers/TextEditor/index.jsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,15 @@ const TextEditor = ({
3232
learningContextId,
3333
images,
3434
isLibrary,
35+
validateAssetUrl,
3536
}) => {
3637
const intl = useIntl();
3738
const { editorRef, refReady, setEditorRef } = prepareEditorRef();
3839
const initialContent = blockValue ? blockValue.data.data : '';
3940
const newContent = replaceStaticWithAsset({
4041
initialContent,
4142
learningContextId,
43+
validateAssetUrl,
4244
});
4345
const editorContent = newContent || initialContent;
4446
let staticRootUrl;
@@ -106,6 +108,7 @@ TextEditor.defaultProps = {
106108
blockValue: null,
107109
blockFinished: null,
108110
returnFunction: null,
111+
validateAssetUrl: null,
109112
};
110113
TextEditor.propTypes = {
111114
onClose: PropTypes.func.isRequired,
@@ -122,6 +125,7 @@ TextEditor.propTypes = {
122125
learningContextId: PropTypes.string, // This should be required but is NULL when the store is in initial state :/
123126
images: PropTypes.shape({}).isRequired,
124127
isLibrary: PropTypes.bool.isRequired,
128+
validateAssetUrl: PropTypes.bool,
125129
};
126130

127131
export const mapStateToProps = (state) => ({

src/editors/containers/TextEditor/index.test.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ describe('TextEditor', () => {
7070
test('renders static images with relative paths', () => {
7171
const updatedProps = {
7272
...props,
73+
validateAssetUrl: false,
7374
blockValue: { data: { data: 'eDiTablE Text with <img src="/static/img.jpg" />' } },
7475
};
7576
const { container } = render(<TextEditor {...updatedProps} />);

0 commit comments

Comments
 (0)