File tree Expand file tree Collapse file tree 3 files changed +60
-2
lines changed
courseware/course/sequence/Unit
plugin-slots/ContentIFrameErrorSlot Expand file tree Collapse file tree 3 files changed +60
-2
lines changed Original file line number Diff line number Diff line change 11import PropTypes from 'prop-types' ;
22
3- import { ErrorPage } from '@edx/frontend-platform/react' ;
43import { ModalDialog } from '@openedx/paragon' ;
54import { ContentIFrameLoaderSlot } from '../../../../plugin-slots/ContentIFrameLoaderSlot' ;
5+ import { ContentIFrameErrorSlot } from '../../../../plugin-slots/ContentIFrameErrorSlot' ;
66
77import * as hooks from './hooks' ;
88
@@ -66,7 +66,11 @@ const ContentIFrame = ({
6666 return (
6767 < >
6868 { ( shouldShowContent && ! hasLoaded ) && (
69- showError ? < ErrorPage /> : < ContentIFrameLoaderSlot courseId = { courseId } loadingMessage = { loadingMessage } />
69+ showError ? (
70+ < ContentIFrameErrorSlot courseId = { courseId } />
71+ ) : (
72+ < ContentIFrameLoaderSlot courseId = { courseId } loadingMessage = { loadingMessage } />
73+ )
7074 ) }
7175 { shouldShowContent && (
7276 < div className = "unit-iframe-wrapper" >
Original file line number Diff line number Diff line change 1+ # Content iFrame Error Slot
2+
3+ ### Slot ID: ` org.openedx.frontend.learning.content_iframe_error.v1 `
4+
5+ ### Parameters: ` courseId `
6+
7+ ## Description
8+
9+ This slot is used to replace/modify the content iframe error page.
10+
11+ ## Example
12+
13+ The following ` env.config.jsx ` will replace the error page with emojis.
14+
15+ ``` js
16+ import { DIRECT_PLUGIN , PLUGIN_OPERATIONS } from ' @openedx/frontend-plugin-framework' ;
17+
18+ const config = {
19+ pluginSlots: {
20+ ' org.openedx.frontend.learning.content_iframe_error.v1' : {
21+ keepDefault: false ,
22+ plugins: [
23+ {
24+ op: PLUGIN_OPERATIONS .Insert ,
25+ widget: {
26+ id: ' custom_error_page' ,
27+ type: DIRECT_PLUGIN ,
28+ RenderWidget : ({courseId}) => (
29+ < h1> 🚨🤖💥< / h1>
30+ ),
31+ },
32+ },
33+ ]
34+ }
35+ },
36+ }
37+
38+ export default config ;
39+ ```
Original file line number Diff line number Diff line change 1+ import { PluginSlot } from '@openedx/frontend-plugin-framework' ;
2+ import { ErrorPage } from '@edx/frontend-platform/react' ;
3+
4+ interface Props {
5+ courseId : string ;
6+ }
7+
8+ export const ContentIFrameErrorSlot : React . FC < Props > = ( { courseId } : Props ) => (
9+ < PluginSlot
10+ id = "org.openedx.frontend.learning.content_iframe_error.v1"
11+ pluginProps = { { courseId } }
12+ >
13+ < ErrorPage />
14+ </ PluginSlot >
15+ ) ;
You can’t perform that action at this time.
0 commit comments