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 1
1
import PropTypes from 'prop-types' ;
2
2
3
- import { ErrorPage } from '@edx/frontend-platform/react' ;
4
3
import { ModalDialog } from '@openedx/paragon' ;
5
4
import { ContentIFrameLoaderSlot } from '../../../../plugin-slots/ContentIFrameLoaderSlot' ;
5
+ import { ContentIFrameErrorSlot } from '../../../../plugin-slots/ContentIFrameErrorSlot' ;
6
6
7
7
import * as hooks from './hooks' ;
8
8
@@ -66,7 +66,11 @@ const ContentIFrame = ({
66
66
return (
67
67
< >
68
68
{ ( shouldShowContent && ! hasLoaded ) && (
69
- showError ? < ErrorPage /> : < ContentIFrameLoaderSlot courseId = { courseId } loadingMessage = { loadingMessage } />
69
+ showError ? (
70
+ < ContentIFrameErrorSlot courseId = { courseId } />
71
+ ) : (
72
+ < ContentIFrameLoaderSlot courseId = { courseId } loadingMessage = { loadingMessage } />
73
+ )
70
74
) }
71
75
{ shouldShowContent && (
72
76
< div className = "unit-iframe-wrapper" >
Original file line number Diff line number Diff line change
1
+ # Content iframe Loader 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
+ export const ContentIFrameErrorSlot : React . FC < Props > = ( { courseId} ) => (
5
+ < PluginSlot
6
+ id = "org.openedx.frontend.learning.content_iframe_error.v1"
7
+ pluginProps = { { courseId} }
8
+ >
9
+ < ErrorPage />
10
+ </ PluginSlot >
11
+ ) ;
12
+
13
+ interface Props {
14
+ courseId : string ;
15
+ }
You can’t perform that action at this time.
0 commit comments